Skip to content

Commit 3496ef2

Browse files
committed
rebase to Chromium 32
1 parent b542877 commit 3496ef2

40 files changed

Lines changed: 416 additions & 394 deletions

nw.gypi

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'target_name': 'nw_lib',
1717
'type': 'static_library',
1818
'defines!': ['CONTENT_IMPLEMENTATION'],
19+
'defines': ['BREAKPAD_IMPLEMENTATION'],
1920
'variables': {
2021
'chromium_code': 1,
2122
},
@@ -45,7 +46,7 @@
4546
'<(DEPTH)/ui/ui.gyp:ui_resources',
4647
'<(DEPTH)/url/url.gyp:url_lib',
4748
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
48-
'<(DEPTH)/webkit/support/webkit_support.gyp:webkit_support',
49+
'<(DEPTH)/webkit/glue/webkit_glue.gyp:glue',
4950
'<(DEPTH)/third_party/zlib/zlib.gyp:minizip',
5051
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
5152
'nw_resources',
@@ -64,10 +65,10 @@
6465
'sources': [
6566
'<(DEPTH)/chrome/browser/chrome_process_finder_win.cc',
6667
'<(DEPTH)/chrome/browser/chrome_process_finder_win.h',
67-
'<(DEPTH)/chrome/common/child_process_logging.h',
68-
'<(DEPTH)/chrome/common/child_process_logging_mac.mm',
69-
'<(DEPTH)/chrome/common/child_process_logging_posix.cc',
70-
'<(DEPTH)/chrome/common/child_process_logging_win.cc',
68+
#'<(DEPTH)/chrome/common/child_process_logging.h',
69+
#'<(DEPTH)/chrome/common/child_process_logging_mac.mm',
70+
#'<(DEPTH)/chrome/common/child_process_logging_posix.cc',
71+
#'<(DEPTH)/chrome/common/child_process_logging_win.cc',
7172
'<(DEPTH)/chrome/common/crash_keys.cc',
7273
'<(DEPTH)/chrome/common/dump_without_crashing.cc',
7374
'<(DEPTH)/chrome/common/env_vars.cc',
@@ -189,6 +190,8 @@
189190
'src/browser/printing/print_job_worker_owner.h',
190191
'src/browser/printing/printing_message_filter.cc',
191192
'src/browser/printing/printing_message_filter.h',
193+
'src/browser/printing/printing_ui_web_contents_observer.cc',
194+
'src/browser/printing/printing_ui_web_contents_observer.h',
192195
'src/browser/printing/printer_query.cc',
193196
'src/browser/printing/printer_query.h',
194197
'src/browser/printing/print_view_manager.cc',
@@ -584,7 +587,7 @@
584587
},
585588
],
586589
'dependencies': [
587-
'<(DEPTH)/chrome/chrome.gyp:chromedriver2_server',
590+
'<(DEPTH)/chrome/chrome.gyp:chromedriver',
588591
],
589592
'conditions': [
590593
['OS == "linux"', {

src/api/clipboard/clipboard.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ void Clipboard::SetText(std::string& text) {
6868
ui::Clipboard::ObjectMap map;
6969
map[ui::Clipboard::CBF_TEXT].push_back(
7070
std::vector<char>(text.begin(), text.end()));
71-
clipboard->WriteObjects(ui::Clipboard::BUFFER_STANDARD, map);
71+
clipboard->WriteObjects(ui::CLIPBOARD_TYPE_COPY_PASTE, map);
7272
}
7373

7474
std::string Clipboard::GetText() {
7575
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
7676
string16 text;
77-
clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &text);
77+
clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &text);
7878
return UTF16ToUTF8(text);
7979
}
8080

8181
void Clipboard::Clear() {
8282
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
83-
clipboard->Clear(ui::Clipboard::BUFFER_STANDARD);
83+
clipboard->Clear(ui::CLIPBOARD_TYPE_COPY_PASTE);
8484
}
8585

8686
} // namespace nwapi

src/api/dispatcher.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ void Dispatcher::OnEvent(int object_id,
7575
DVLOG(1) << "Dispatcher::OnEvent(object_id=" << object_id << ", event=\"" << event << "\")";
7676

7777
content::V8ValueConverterImpl converter;
78-
v8::Handle<v8::Value> args = converter.ToV8Value(&arguments, node::g_context);
78+
v8::Local<v8::Context> context =
79+
v8::Local<v8::Context>::New(node::g_context->GetIsolate(), node::g_context);
80+
81+
v8::Handle<v8::Value> args = converter.ToV8Value(&arguments, context);
7982
DCHECK(!args.IsEmpty()) << "Invalid 'arguments' in Dispatcher::OnEvent";
8083
v8::Handle<v8::Value> argv[] = {
8184
v8::Integer::New(object_id), v8::String::New(event.c_str()), args };

src/api/dispatcher_host.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ IDMap<Base, IDMapOwnPointer> nwapi::DispatcherHost::objects_registry_;
4949
int nwapi::DispatcherHost::next_object_id_ = 1;
5050
static std::map<content::RenderViewHost*, DispatcherHost*> g_dispatcher_host_map;
5151

52-
DispatcherHost::DispatcherHost(content::RenderViewHost* render_view_host)
53-
: content::RenderViewHostObserver(render_view_host) {
54-
g_dispatcher_host_map[render_view_host] = this;
52+
DispatcherHost::DispatcherHost(content::RenderViewHost* host)
53+
: content::WebContentsObserver(content::WebContents::FromRenderViewHost(host)),
54+
render_view_host_(host) {
55+
g_dispatcher_host_map[render_view_host_] = this;
5556
}
5657

5758
DispatcherHost::~DispatcherHost() {
@@ -87,7 +88,7 @@ void DispatcherHost::SendEvent(Base* object,
8788
}
8889

8990
bool DispatcherHost::Send(IPC::Message* message) {
90-
return content::RenderViewHostObserver::Send(message);
91+
return content::WebContentsObserver::Send(message);
9192
}
9293

9394
bool DispatcherHost::OnMessageReceived(const IPC::Message& message) {

src/api/dispatcher_host.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "base/basictypes.h"
2525
#include "base/id_map.h"
26-
#include "content/public/browser/render_view_host_observer.h"
26+
#include "content/public/browser/web_contents_observer.h"
2727

2828
#include <string>
2929

@@ -44,7 +44,7 @@ namespace nwapi {
4444

4545
class Base;
4646

47-
class DispatcherHost : public content::RenderViewHostObserver {
47+
class DispatcherHost : public content::WebContentsObserver {
4848
public:
4949
explicit DispatcherHost(content::RenderViewHost* render_view_host);
5050
virtual ~DispatcherHost();
@@ -68,16 +68,18 @@ class DispatcherHost : public content::RenderViewHostObserver {
6868

6969
virtual bool Send(IPC::Message* message) OVERRIDE;
7070
content::RenderViewHost* render_view_host() const {
71-
return content::RenderViewHostObserver::render_view_host();
71+
return render_view_host_;
7272
}
7373

7474
private:
75+
content::RenderViewHost* render_view_host_;
7576
friend class content::Shell;
7677

7778
static IDMap<Base, IDMapOwnPointer> objects_registry_;
7879
static int next_object_id_;
7980

8081
// RenderViewHostObserver implementation.
82+
// WebContentsObserver implementation:
8183
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
8284

8385
void OnAllocateObject(int object_id,

src/api/window_bindings.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
#undef LOG
2929
using namespace WebCore;
3030

31-
#include "V8HTMLIFrameElement.h"
31+
#include "third_party/WebKit/Source/config.h"
3232
#include "third_party/WebKit/Source/core/html/HTMLIFrameElement.h"
3333
#include "third_party/WebKit/public/web/WebFrame.h"
3434
#include "third_party/WebKit/public/web/WebView.h"
3535
#include "third_party/WebKit/Source/web/WebFrameImpl.h"
3636

37+
#include "V8HTMLIFrameElement.h"
38+
3739

3840
namespace nwapi {
3941

src/breakpad_linux.cc

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// For linux_syscall_support.h. This makes it safe to call embedded system
66
// calls when in seccomp mode.
77

8-
#include "chrome/app/breakpad_linux.h"
8+
#include "components/breakpad/app/breakpad_linux.h"
99

1010
#include <fcntl.h>
1111
#include <poll.h>
@@ -40,7 +40,7 @@
4040
#include "content/nw/src/breakpad_linux_impl.h"
4141
#include "chrome/common/child_process_logging.h"
4242
#include "chrome/common/chrome_paths.h"
43-
#include "components/breakpad/breakpad_client.h"
43+
#include "components/breakpad/app/breakpad_client.h"
4444
#include "content/public/common/content_descriptors.h"
4545
#include "content/public/common/content_switches.h"
4646

@@ -74,6 +74,8 @@
7474
using google_breakpad::ExceptionHandler;
7575
using google_breakpad::MinidumpDescriptor;
7676

77+
using breakpad::GetBreakpadClient;
78+
7779
namespace {
7880

7981
const char kUploadURL[] = "https://clients2.google.com/cr/report";
@@ -193,26 +195,12 @@ size_t LengthWithoutTrailingSpaces(const char* str, size_t len) {
193195
return len;
194196
}
195197

196-
// Populates the passed in allocated strings and their sizes with the GUID,
197-
// crash url and distro of the crashing process.
198-
// The passed strings are expected to be at least kGuidSize, kMaxActiveURLSize
199-
// and kDistroSize bytes long respectively.
200-
void PopulateGUIDAndURLAndDistro(char* guid, size_t* guid_len_param,
201-
char* crash_url, size_t* crash_url_len_param,
202-
char* distro, size_t* distro_len_param) {
203-
size_t guid_len = std::min(my_strlen(child_process_logging::g_client_id),
204-
kGuidSize);
205-
size_t crash_url_len =
206-
std::min(my_strlen(child_process_logging::g_active_url),
207-
kMaxActiveURLSize);
198+
// Populates the passed in allocated string and its size with the distro of
199+
// the crashing process.
200+
// The passed string is expected to be at least kDistroSize bytes long.
201+
void PopulateDistro(char* distro, size_t* distro_len_param) {
208202
size_t distro_len = std::min(my_strlen(base::g_linux_distro), kDistroSize);
209-
memcpy(guid, child_process_logging::g_client_id, guid_len);
210-
memcpy(crash_url, child_process_logging::g_active_url, crash_url_len);
211203
memcpy(distro, base::g_linux_distro, distro_len);
212-
if (guid_len_param)
213-
*guid_len_param = guid_len;
214-
if (crash_url_len_param)
215-
*crash_url_len_param = crash_url_len;
216204
if (distro_len_param)
217205
*distro_len_param = distro_len;
218206
}
@@ -223,10 +211,10 @@ void SetClientIdFromCommandLine(const CommandLine& command_line) {
223211
command_line.GetSwitchValueASCII(switches::kEnableCrashReporter);
224212
size_t separator = switch_value.find(",");
225213
if (separator != std::string::npos) {
226-
child_process_logging::SetClientId(switch_value.substr(0, separator));
214+
GetBreakpadClient()->SetClientID(switch_value.substr(0, separator));
227215
base::SetLinuxDistro(switch_value.substr(separator + 1));
228216
} else {
229-
child_process_logging::SetClientId(switch_value);
217+
GetBreakpadClient()->SetClientID(switch_value);
230218
}
231219
}
232220

@@ -598,8 +586,6 @@ bool CrashDone(const MinidumpDescriptor& minidump,
598586
info.process_type_length = 7;
599587
info.crash_url = NULL;
600588
info.crash_url_length = 0;
601-
info.guid = child_process_logging::g_client_id;
602-
info.guid_length = my_strlen(child_process_logging::g_client_id);
603589
info.distro = base::g_linux_distro;
604590
info.distro_length = my_strlen(base::g_linux_distro);
605591
info.upload = upload;
@@ -708,17 +694,14 @@ bool CrashDoneInProcessNoUpload(
708694
size_t guid_length = 0;
709695
size_t crash_url_length = 0;
710696
size_t distro_length = 0;
711-
PopulateGUIDAndURLAndDistro(guid, &guid_length, crash_url, &crash_url_length,
712-
distro, &distro_length);
697+
PopulateDistro(distro, &distro_length);
713698
BreakpadInfo info = {0};
714699
info.filename = NULL;
715700
info.fd = descriptor.fd();
716701
info.process_type = g_process_type;
717702
info.process_type_length = my_strlen(g_process_type);
718703
info.crash_url = crash_url;
719704
info.crash_url_length = crash_url_length;
720-
info.guid = guid;
721-
info.guid_length = guid_length;
722705
info.distro = distro;
723706
info.distro_length = distro_length;
724707
info.upload = false;
@@ -773,10 +756,8 @@ bool NonBrowserCrashHandler(const void* crash_context,
773756
}
774757

775758
// Start constructing the message to send to the browser.
776-
char guid[kGuidSize + 1] = {0};
777-
char crash_url[kMaxActiveURLSize + 1] = {0};
778759
char distro[kDistroSize + 1] = {0};
779-
PopulateGUIDAndURLAndDistro(guid, NULL, crash_url, NULL, distro, NULL);
760+
PopulateDistro(distro, NULL);
780761

781762
char b; // Dummy variable for sys_read below.
782763
const char* b_addr = &b; // Get the address of |b| so we can create the
@@ -793,28 +774,24 @@ bool NonBrowserCrashHandler(const void* crash_context,
793774
struct kernel_iovec iov[kCrashIovSize];
794775
iov[0].iov_base = const_cast<void*>(crash_context);
795776
iov[0].iov_len = crash_context_size;
796-
iov[1].iov_base = guid;
797-
iov[1].iov_len = kGuidSize + 1;
798-
iov[2].iov_base = crash_url;
799-
iov[2].iov_len = kMaxActiveURLSize + 1;
800-
iov[3].iov_base = distro;
801-
iov[3].iov_len = kDistroSize + 1;
802-
iov[4].iov_base = &b_addr;
803-
iov[4].iov_len = sizeof(b_addr);
804-
iov[5].iov_base = &fds[0];
805-
iov[5].iov_len = sizeof(fds[0]);
806-
iov[6].iov_base = &g_process_start_time;
807-
iov[6].iov_len = sizeof(g_process_start_time);
808-
iov[7].iov_base = &base::g_oom_size;
809-
iov[7].iov_len = sizeof(base::g_oom_size);
777+
iov[1].iov_base = distro;
778+
iov[1].iov_len = kDistroSize + 1;
779+
iov[2].iov_base = &b_addr;
780+
iov[2].iov_len = sizeof(b_addr);
781+
iov[3].iov_base = &fds[0];
782+
iov[3].iov_len = sizeof(fds[0]);
783+
iov[4].iov_base = &g_process_start_time;
784+
iov[4].iov_len = sizeof(g_process_start_time);
785+
iov[5].iov_base = &base::g_oom_size;
786+
iov[5].iov_len = sizeof(base::g_oom_size);
810787
google_breakpad::SerializedNonAllocatingMap* serialized_map;
811-
iov[8].iov_len = g_crash_keys->Serialize(
788+
iov[6].iov_len = g_crash_keys->Serialize(
812789
const_cast<const google_breakpad::SerializedNonAllocatingMap**>(
813790
&serialized_map));
814-
iov[8].iov_base = serialized_map;
791+
iov[6].iov_base = serialized_map;
815792
#if defined(ADDRESS_SANITIZER)
816-
iov[9].iov_base = const_cast<char*>(g_asan_report_str);
817-
iov[9].iov_len = kMaxAsanReportSize + 1;
793+
iov[7].iov_base = const_cast<char*>(g_asan_report_str);
794+
iov[7].iov_len = kMaxAsanReportSize + 1;
818795
#endif
819796

820797
msg.msg_iov = iov;

0 commit comments

Comments
 (0)