Skip to content

Commit 670552e

Browse files
committed
rebase to Chromium 57
1 parent c671da9 commit 670552e

15 files changed

+51
-31
lines changed

BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ action("commit_id") {
232232
"//content/nw/.git/index",
233233
"//.git/index",
234234
"//v8/.git/index",
235-
"//third_party/node/.git/index"
235+
"//third_party/node-nw/.git/index"
236236
]
237237
outputs = [
238238
commit_id_output_file,

src/api/nw_app_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ bool NwAppClearCacheFunction::RunNWSync(base::ListValue* response, std::string*
129129
Profile::FromBrowserContext(context_));
130130

131131
remover->AddObserver(this);
132-
remover->RemoveAndReply(BrowsingDataRemover::Unbounded(),
132+
remover->RemoveAndReply(base::Time(), base::Time::Max(),
133133
BrowsingDataRemover::REMOVE_CACHE,
134134
BrowsingDataHelper::ALL,
135135
this);

src/api/nw_window_api.cc

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ static void SetDeskopEnvironment() {
8686

8787
#endif
8888

89+
namespace {
90+
91+
printing::PrinterList EnumeratePrintersOnBlockingPoolThread() {
92+
DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
93+
94+
scoped_refptr<printing::PrintBackend> print_backend(
95+
printing::PrintBackend::CreateInstance(nullptr));
96+
97+
printing::PrinterList printer_list;
98+
print_backend->EnumeratePrinters(&printer_list);
99+
100+
return printer_list;
101+
}
102+
}
103+
89104
namespace extensions {
90105
namespace {
91106

@@ -556,7 +571,7 @@ bool NwCurrentWindowInternalSetProgressBarFunction::RunAsync() {
556571

557572
bool NwCurrentWindowInternalReloadIgnoringCacheFunction::RunAsync() {
558573
content::WebContents* web_contents = GetSenderWebContents();
559-
web_contents->GetController().ReloadBypassingCache(false);
574+
web_contents->GetController().Reload(content::ReloadType::BYPASSING_CACHE, false);
560575
SendResponse(true);
561576
return true;
562577
}
@@ -639,9 +654,13 @@ bool NwCurrentWindowInternalSetTitleInternalFunction::RunNWSync(base::ListValue*
639654
}
640655

641656
bool NwCurrentWindowInternalGetPrintersFunction::RunAsync() {
642-
printing::EnumeratePrinters(Profile::FromBrowserContext(browser_context()),
643-
base::Bind(&NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList,
644-
this));
657+
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
658+
659+
base::PostTaskAndReplyWithResult(
660+
content::BrowserThread::GetBlockingPool(), FROM_HERE,
661+
base::Bind(&EnumeratePrintersOnBlockingPoolThread),
662+
base::Bind(&NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList,
663+
this));
645664
return true;
646665
}
647666

@@ -659,7 +678,7 @@ bool NwCurrentWindowInternalSetPrintSettingsInternalFunction::RunNWSync(base::Li
659678
return false;
660679
base::Value* spec = NULL;
661680
EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &spec) && spec);
662-
if (!spec->IsType(base::Value::TYPE_DICTIONARY))
681+
if (!spec->IsType(base::Value::Type::DICTIONARY))
663682
return false;
664683
const base::DictionaryValue* dict = static_cast<const base::DictionaryValue*>(spec);
665684
bool auto_print;

src/api/object_manager.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using extensions::EventRouter;
5050

5151
namespace nw {
5252

53-
IDMap<Base, IDMapOwnPointer> nw::ObjectManager::objects_registry_;
53+
IDMap<std::unique_ptr<Base>> nw::ObjectManager::objects_registry_;
5454
int nw::ObjectManager::next_object_id_ = 0;
5555

5656
ObjectManager* ObjectManager::Get(content::BrowserContext* context) {
@@ -92,28 +92,28 @@ void ObjectManager::OnAllocateObject(int object_id,
9292
<< " option:" << option;
9393

9494
if (type == "Menu") {
95-
objects_registry_.AddWithID(new Menu(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
95+
objects_registry_.AddWithID(base::MakeUnique<Menu>(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
9696
} else if (type == "MenuItem") {
9797
objects_registry_.AddWithID(
98-
new MenuItem(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
98+
base::MakeUnique<MenuItem>(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
9999
} else if (type == "Tray") {
100-
objects_registry_.AddWithID(new Tray(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
100+
objects_registry_.AddWithID(base::MakeUnique<Tray>(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
101101
}
102102
#if 0
103103
else if (type == "Clipboard") {
104104
objects_registry_.AddWithID(
105-
new Clipboard(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
105+
base::MakeUnique<Clipboard>(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
106106
} else if (type == "Window") {
107-
objects_registry_.AddWithID(new Window(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
107+
objects_registry_.AddWithID(base::MakeUnique<Window>(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
108108
} else if (type == "Shortcut") {
109-
objects_registry_.AddWithID(new Shortcut(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
109+
objects_registry_.AddWithID(base::MakeUnique<Shortcut>(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
110110
} else if (type == "Screen") {
111-
objects_registry_.AddWithID(new EventListener(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
111+
objects_registry_.AddWithID(base::MakeUnique<EventListener>(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
112112
}
113113
#endif
114114
else {
115115
LOG(ERROR) << "Allocate an object of unknown type: " << type;
116-
objects_registry_.AddWithID(new Base(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
116+
objects_registry_.AddWithID(base::MakeUnique<Base>(object_id, weak_ptr_factory_.GetWeakPtr(), option, extension_id), object_id);
117117
}
118118
objects_.insert(object_id);
119119
}

src/api/object_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ObjectManager : public KeyedService {
101101
const base::ListValue& arguments,
102102
base::ListValue* result);
103103
private:
104-
static IDMap<Base, IDMapOwnPointer> objects_registry_;
104+
static IDMap<std::unique_ptr<Base>> objects_registry_;
105105
static int next_object_id_;
106106

107107
base::RunLoop* run_loop_;

src/browser/menubar_controller.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ MenuBarController::MenuBarController(MenuBarView* menubar, ui::MenuModel* menu_m
2424

2525
MenuBarController::~MenuBarController() {
2626
if (master_ == this) {
27-
base::STLDeleteElements(&controllers_);
27+
for (auto ctr : controllers_)
28+
delete ctr;
2829
model_to_menu_map_.clear();
2930
}
3031
}

src/browser/nw_chrome_browser_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void ShowDevtools(bool show, content::WebContents* web_contents, content::WebCon
144144
if (!window) {
145145
Profile* profile = Profile::FromBrowserContext(
146146
web_contents->GetBrowserContext());
147-
window = DevToolsWindow::Create(profile, GURL(), nullptr, false, false, std::string(), false, std::string(), container);
147+
window = DevToolsWindow::Create(profile, GURL(), nullptr, false, false, false, std::string(), false, std::string(), std::string(), container);
148148
if (!window)
149149
return;
150150
window->bindings_->AttachTo(agent_host);

src/browser/nw_content_browser_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// gen
3636
#include "nw/id/commit.h"
3737

38-
#include "third_party/node/src/node_webkit.h"
38+
#include "third_party/node-nw/src/node_webkit.h"
3939

4040
#if defined(OS_WIN)
4141
#define _USE_MATH_DEFINES

src/browser/nw_extensions_browser_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ std::unique_ptr<base::DictionaryValue> MergeManifest() {
140140
// retrieve `window` manifest set by `new-win-policy`
141141
std::string manifest_str = base::UTF16ToUTF8(nw::GetCurrentNewWinManifest());
142142
std::unique_ptr<base::Value> val = base::JSONReader().ReadToValue(manifest_str);
143-
if (val && val->IsType(base::Value::Type::TYPE_DICTIONARY)) {
143+
if (val && val->IsType(base::Value::Type::DICTIONARY)) {
144144
manifest.reset(static_cast<base::DictionaryValue*>(val.release()));
145145
} else {
146146
manifest.reset(new base::DictionaryValue());

src/nw_package.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//#include "grit/nw_resources.h"
4343
#include "media/base/media_switches.h"
4444
#include "net/base/escape.h"
45-
#include "third_party/node/deps/uv/include/uv.h"
45+
#include "third_party/node-nw/deps/uv/include/uv.h"
4646
#include "ui/base/resource/resource_bundle.h"
4747

4848
using base::CommandLine;
@@ -320,7 +320,7 @@ bool Package::InitFromPath(const base::FilePath& path_in) {
320320
manifest_path.AsUTF8Unsafe() :
321321
error);
322322
return false;
323-
} else if (!root->IsType(base::Value::TYPE_DICTIONARY)) {
323+
} else if (!root->IsType(base::Value::Type::DICTIONARY)) {
324324
ReportError("Invalid package.json",
325325
"package.json's content should be a object type.");
326326
return false;

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 20
26-
#define NW_PATCH_VERSION 4
25+
#define NW_MINOR_VERSION 21
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) "-rc1"
42+
NW_STRINGIFY(NW_PATCH_VERSION) "-rc2"
4343
#endif
4444

4545
#define NW_VERSION "v" NW_VERSION_STRING

src/renderer/nw_content_renderer_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// third_party/node
2020
// FIXME: node_webkit.h should include v8 headers
21-
#include "third_party/node/src/node_webkit.h"
21+
#include "third_party/node-nw/src/node_webkit.h"
2222

2323
#if defined(OS_WIN)
2424
#define _USE_MATH_DEFINES

src/renderer/nw_extensions_renderer_hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "third_party/WebKit/Source/platform/ScriptForbiddenScope.h"
3838
#include "third_party/WebKit/public/web/WebKit.h"
3939

40-
#include "third_party/node/src/node_webkit.h"
40+
#include "third_party/node-nw/src/node_webkit.h"
4141

4242
// gen
4343
#include "nw/id/commit.h"

test/sanity/issue4121-inpect-node-crash/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
print 'switch to devtools'
2323
switch_to_devtools(driver)
2424
devtools_click_tab(driver, 'console')
25-
driver.find_element_by_class_name('console-message-url').click()
25+
driver.find_element_by_class_name('devtools-link').click()
2626
sources_panel = driver.find_element_by_css_selector('.panel.sources')
2727
assert(sources_panel is not None)
2828
finally:

test/sanity/issue4269-click-link-crash/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
print 'switch to devtools window'
4040
switch_to_devtools(driver)
4141
devtools_click_tab(driver, 'console')
42-
driver.find_element_by_css_selector('.console-message-text .webkit-html-external-link').click()
42+
driver.find_element_by_css_selector('.console-message-text .devtools-link').click()
4343
wait_window_handles(driver, 4)
4444
driver.switch_to_window(driver.window_handles[3])
4545
print driver.current_url

0 commit comments

Comments
 (0)