Skip to content

Commit d632860

Browse files
GnorTechrogerwang
authored andcommitted
rebase to Chromium 60
1 parent 890b720 commit d632860

File tree

14 files changed

+43
-38
lines changed

14 files changed

+43
-38
lines changed

BUILD.gn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ group("nwjs") {
1919
component("nw_base") {
2020
deps = [
2121
"//base",
22-
"//third_party/zlib:zip",
22+
"//third_party/zlib/google:zip",
2323
"//url",
2424
":commit_id"
2525
]
@@ -57,7 +57,7 @@ if (is_component_build) {
5757
"//skia",
5858
":nw_base",
5959
"//third_party/WebKit/public:blink",
60-
"//third_party/WebKit/Source/wtf",
60+
"//third_party/WebKit/Source/platform/wtf",
6161
"//third_party/protobuf:protobuf_lite",
6262
"//third_party/webrtc/modules/desktop_capture",
6363
]
@@ -183,7 +183,7 @@ static_library("nw_renderer") {
183183
"//extensions/common",
184184
"//extensions/renderer",
185185
"//third_party/WebKit/public:blink",
186-
"//third_party/WebKit/Source/wtf",
186+
"//third_party/WebKit/Source/platform/wtf",
187187
"//skia",
188188
":nw_base",
189189
"//third_party/protobuf:protobuf_lite",

src/api/menu/menu_views.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,13 @@ void Menu::Popup(int x, int y, content::RenderFrameHost* rfh) {
133133
&screen_point);
134134
}
135135
set_delay_destruction(true);
136-
menu_runner_.reset(new views::MenuRunner(menu_model_.get(), views::MenuRunner::CONTEXT_MENU | views::MenuRunner::ASYNC,
136+
menu_runner_.reset(new views::MenuRunner(menu_model_.get(), views::MenuRunner::CONTEXT_MENU,
137137
base::Bind(&Menu::OnMenuClosed, base::Unretained(this))));
138-
ignore_result(
139-
menu_runner_->RunMenuAt(top_level_widget,
138+
menu_runner_->RunMenuAt(top_level_widget,
140139
nullptr,
141140
gfx::Rect(screen_point, gfx::Size()),
142141
views::MENU_ANCHOR_TOPRIGHT,
143-
ui::MENU_SOURCE_NONE));
142+
ui::MENU_SOURCE_NONE);
144143
// It is possible for the same MenuMessageLoopAura to start a nested
145144
// message-loop while it is already running a nested loop. So make
146145
// sure the quit-closure gets reset to the outer loop's quit-closure

src/api/nw_app_api.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "base/memory/ptr_util.h"
55
#include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
66
#include "chrome/browser/browsing_data/browsing_data_helper.h"
7-
#include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
87
#include "chrome/browser/devtools/devtools_window.h"
98
#include "chrome/browser/extensions/devtools_util.h"
109
#include "chrome/browser/extensions/extension_service.h"
@@ -125,13 +124,13 @@ NwAppClearCacheFunction::~NwAppClearCacheFunction() {
125124
}
126125

127126
bool NwAppClearCacheFunction::RunNWSync(base::ListValue* response, std::string* error) {
128-
BrowsingDataRemover* remover = BrowsingDataRemoverFactory::GetForBrowserContext(
127+
content::BrowsingDataRemover* remover = content::BrowserContext::GetBrowsingDataRemover(
129128
Profile::FromBrowserContext(context_));
130129

131130
remover->AddObserver(this);
132131
remover->RemoveAndReply(base::Time(), base::Time::Max(),
133-
BrowsingDataRemover::DATA_TYPE_CACHE,
134-
BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB,
132+
content::BrowsingDataRemover::DATA_TYPE_CACHE,
133+
content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB,
135134
this);
136135
// BrowsingDataRemover deletes itself.
137136
base::MessageLoop::ScopedNestableTaskAllower allow(

src/api/nw_app_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <vector>
55

66
#include "base/run_loop.h"
7-
#include "chrome/browser/browsing_data/browsing_data_remover.h"
7+
#include "content/public/browser/browsing_data_remover.h"
88
#include "extensions/browser/extension_function.h"
99

1010
namespace extensions {
@@ -49,7 +49,7 @@ class NwAppGetArgvSyncFunction : public NWSyncExtensionFunction {
4949
DISALLOW_COPY_AND_ASSIGN(NwAppGetArgvSyncFunction);
5050
};
5151

52-
class NwAppClearCacheFunction : public NWSyncExtensionFunction, public BrowsingDataRemover::Observer {
52+
class NwAppClearCacheFunction : public NWSyncExtensionFunction, public content::BrowsingDataRemover::Observer {
5353
public:
5454
NwAppClearCacheFunction();
5555
bool RunNWSync(base::ListValue* response, std::string* error) override;

src/api/nw_clipboard_api.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ namespace {
9292
DCHECK(data.type == TYPE_PNG || data.type == TYPE_JPEG);
9393
std::vector<unsigned char> encoded_image;
9494
SkBitmap bitmap = clipboard_->ReadImage(ui::CLIPBOARD_TYPE_COPY_PASTE);
95-
SkAutoLockPixels lock(bitmap);
9695

9796
if (bitmap.isNull()) {
9897
return true;

src/api/nw_screen_api.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ void NwDesktopCaptureMonitor::OnSourceThumbnailChanged(DesktopMediaList* list, i
309309

310310
DesktopMediaList::Source src = media_list_->GetSource(index);
311311
SkBitmap bitmap = src.thumbnail.GetRepresentation(1).sk_bitmap();
312-
SkAutoLockPixels lock_image(bitmap);
313312
std::vector<unsigned char> data;
314313
bool success = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &data);
315314
if (success){

src/api/nw_window_api.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ void NwCurrentWindowInternalCapturePageInternalFunction::CopyFromBackingStoreCom
251251

252252
void NwCurrentWindowInternalCapturePageInternalFunction::OnCaptureSuccess(const SkBitmap& bitmap) {
253253
std::vector<unsigned char> data;
254-
SkAutoLockPixels screen_capture_lock(bitmap);
255254
bool encoded = false;
256255
std::string mime_type;
257256
switch (image_format_) {
@@ -414,7 +413,7 @@ static base::win::ScopedHICON createBadgeIcon(const HWND hWnd, const TCHAR *valu
414413
canvas.DrawStringRectWithFlags(value, gfx::FontList(font), SK_ColorWHITE, gfx::Rect(sizeX, fontSize + yMargin + 1), gfx::Canvas::TEXT_ALIGN_CENTER);
415414

416415
// return the canvas as windows native icon handle
417-
return std::move(IconUtil::CreateHICONFromSkBitmap(canvas.ExtractImageRep().sk_bitmap()));
416+
return std::move(IconUtil::CreateHICONFromSkBitmap(canvas.GetBitmap()));
418417
}
419418
#endif
420419

@@ -425,8 +424,8 @@ bool NwCurrentWindowInternalSetBadgeLabelFunction::RunAsync() {
425424
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &badge));
426425
#if defined(OS_WIN)
427426
base::win::ScopedComPtr<ITaskbarList3> taskbar;
428-
HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL,
429-
CLSCTX_INPROC_SERVER);
427+
HRESULT result = ::CoCreateInstance(CLSID_TaskbarList, nullptr,
428+
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar));
430429

431430
if (FAILED(result)) {
432431
error_ = "Failed creating a TaskbarList3 object: ";
@@ -508,8 +507,8 @@ bool NwCurrentWindowInternalSetProgressBarFunction::RunAsync() {
508507
EXTENSION_FUNCTION_VALIDATE(args_->GetDouble(0, &progress));
509508
#if defined(OS_WIN)
510509
base::win::ScopedComPtr<ITaskbarList3> taskbar;
511-
HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL,
512-
CLSCTX_INPROC_SERVER);
510+
HRESULT result = ::CoCreateInstance(CLSID_TaskbarList, nullptr,
511+
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar));
513512

514513
if (FAILED(result)) {
515514
error_ = "Failed creating a TaskbarList3 object: ";
@@ -724,8 +723,8 @@ bool NwCurrentWindowInternalSetShowInTaskbarFunction::RunAsync() {
724723
}
725724

726725
base::win::ScopedComPtr<ITaskbarList> taskbar;
727-
HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL,
728-
CLSCTX_INPROC_SERVER);
726+
HRESULT result = ::CoCreateInstance(CLSID_TaskbarList, nullptr,
727+
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar));
729728
if (FAILED(result)) {
730729
VLOG(1) << "Failed creating a TaskbarList object: " << result;
731730
SendResponse(true);

src/api/shell/shell.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "base/bind.h"
2626
#include "base/logging.h"
2727
#include "base/values.h"
28+
#include "base/task_scheduler/post_task.h"
2829
#include "content/public/browser/browser_context.h"
2930
#include "content/public/browser/browser_thread.h"
3031
#include "chrome/browser/platform_util.h"
@@ -62,8 +63,9 @@ void Shell::Call(const std::string& method,
6263
arguments.GetString(0, &full_path);
6364
FilePath path = FilePath::FromUTF8Unsafe(full_path);
6465
platform_util::OpenItemType *item_type = new platform_util::OpenItemType();
65-
content::BrowserThread::PostBlockingPoolTaskAndReply(
66+
base::PostTaskWithTraitsAndReply(
6667
FROM_HERE,
68+
{base::MayBlock(), base::TaskPriority::BACKGROUND},
6769
base::Bind(&VerifyItemType, path, base::Unretained(item_type)),
6870
base::Bind(&OnItemTypeVerified, profile, path, base::Owned(item_type))
6971
);

src/browser/menubar_controller.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ MenuBarController::MenuBarController(MenuBarView* menubar, ui::MenuModel* menu_m
2020
MenuBarController::CreateMenu(menubar, menu_model, this);
2121
if (!master) {
2222
master_ = this;
23-
menu_runner_.reset(new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC, base::Bind(&MenuBarController::OnMenuClose, base::Unretained(this))));
23+
menu_runner_.reset(new views::MenuRunner(menu_model,
24+
views::MenuRunner::HAS_MNEMONICS,
25+
base::Bind(&MenuBarController::OnMenuClose,
26+
base::Unretained(this))));
2427
}
2528
}
2629

@@ -99,11 +102,11 @@ void MenuBarController::RunMenuAt(views::View* view, const gfx::Point& point) {
99102
gfx::Rect bounds(screen_loc.x(), screen_loc.y(), menu_button->width(),
100103
menu_button->height() - 1);
101104

102-
ignore_result(menu_runner_->RunMenuAt(view->GetWidget()->GetTopLevelWidget(),
105+
menu_runner_->RunMenuAt(view->GetWidget()->GetTopLevelWidget(),
103106
menu_button,
104107
bounds,
105108
views::MENU_ANCHOR_TOPLEFT,
106-
ui::MENU_SOURCE_NONE));
109+
ui::MENU_SOURCE_NONE);
107110
{
108111
base::AutoReset<base::Closure> reset_quit_closure(&message_loop_quit_,
109112
base::Closure());

src/nw_custom_bindings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void NWCustomBindings::EvalNWBin(
234234
v8::Local<v8::UnboundScript> script;
235235
script = v8::ScriptCompiler::CompileUnboundScript(
236236
isolate, &source, v8::ScriptCompiler::kConsumeCodeCache).ToLocalChecked();
237-
ASSERT(!cache->rejected);
237+
CHECK(!cache->rejected);
238238
v8::Handle<v8::Value> result;
239239
v8::Handle<v8::Object> frm = v8::Handle<v8::Object>::Cast(args[0]);
240240
WebFrame* web_frame = NULL;

src/nw_version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define NW_VERSION_H
2323

2424
#define NW_MAJOR_VERSION 0
25-
#define NW_MINOR_VERSION 23
26-
#define NW_PATCH_VERSION 7
25+
#define NW_MINOR_VERSION 24
26+
#define NW_PATCH_VERSION 0
2727

28-
#define NW_VERSION_IS_RELEASE 1
28+
#define NW_VERSION_IS_RELEASE 0
2929

3030
#ifndef NW_STRINGIFY
3131
#define NW_STRINGIFY(n) NW_STRINGIFY_HELPER(n)
@@ -39,7 +39,7 @@
3939
#else
4040
# define NW_VERSION_STRING NW_STRINGIFY(NW_MAJOR_VERSION) "." \
4141
NW_STRINGIFY(NW_MINOR_VERSION) "." \
42-
NW_STRINGIFY(NW_PATCH_VERSION) ""
42+
NW_STRINGIFY(NW_PATCH_VERSION) "-beta1"
4343
#endif
4444

4545
#define NW_VERSION "v" NW_VERSION_STRING

src/nwjs_browsertest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
3434
#include "chrome/browser/download/download_history.h"
3535
#include "chrome/browser/download/download_prefs.h"
36-
#include "chrome/browser/download/download_service.h"
37-
#include "chrome/browser/download/download_service_factory.h"
36+
#include "chrome/browser/download/download_core_service.h"
37+
#include "chrome/browser/download/download_core_service_factory.h"
3838
#include "chrome/browser/lifetime/application_lifetime.h"
3939
#include "chrome/browser/pdf/pdf_extension_test_util.h"
4040
#include "chrome/browser/prerender/prerender_link_manager.h"

test/sanity/node-remote-negtive/test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import time
22
import os
3+
import sys
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
5+
from nw_util import *
36
import subprocess
47

58
from selenium import webdriver
@@ -28,9 +31,8 @@
2831
try:
2932
print driver.current_url
3033
time.sleep(1)
31-
result = driver.find_element_by_id('result')
32-
print result.get_attribute('innerHTML')
33-
assert("success" in result.get_attribute('innerHTML'))
34+
result = wait_for_element_id_content(driver, 'result', 'success')
35+
print result
3436
finally:
3537
server.terminate()
3638
driver.quit()

test/sanity/window-eval/test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import time
22
import os
3+
import sys
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
5+
from nw_util import *
36

47
from selenium import webdriver
58
from selenium.webdriver.chrome.options import Options
@@ -9,7 +12,7 @@
912
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
1013
try:
1114
print driver.current_url
12-
time.sleep(1)
15+
wait_for_element_id_content(driver, 'result', 'success')
1316
result = driver.find_element_by_id('result')
1417
print result.get_attribute('innerHTML')
1518
assert("success" in result.get_attribute('innerHTML'))

0 commit comments

Comments
 (0)