Skip to content

Commit 5bc3213

Browse files
committed
rebase to Chromium 78
1 parent a471e59 commit 5bc3213

13 files changed

+54
-53
lines changed

src/api/nw_app_api.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace extensions {
1111
class AppWindowRegistry;
1212
class ExtensionService;
1313

14-
class NwAppQuitFunction : public UIThreadExtensionFunction {
14+
class NwAppQuitFunction : public ExtensionFunction {
1515
public:
1616
NwAppQuitFunction();
1717

@@ -26,7 +26,7 @@ class NwAppQuitFunction : public UIThreadExtensionFunction {
2626
void Callback();
2727
};
2828

29-
class NwAppCloseAllWindowsFunction : public UIThreadExtensionFunction {
29+
class NwAppCloseAllWindowsFunction : public ExtensionFunction {
3030
public:
3131
NwAppCloseAllWindowsFunction() {}
3232

@@ -109,7 +109,7 @@ class NwAppGetDataPathFunction : public NWSyncExtensionFunction {
109109
DISALLOW_COPY_AND_ASSIGN(NwAppGetDataPathFunction);
110110
};
111111

112-
class NwAppCrashBrowserFunction : public UIThreadExtensionFunction {
112+
class NwAppCrashBrowserFunction : public ExtensionFunction {
113113
public:
114114
NwAppCrashBrowserFunction() {}
115115

src/api/nw_clipboard_api.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace {
6666
bool ReadText(ClipboardData& data) {
6767
DCHECK(data.type == TYPE_TEXT);
6868
base::string16 text;
69-
clipboard_->ReadText(ui::ClipboardType::kCopyPaste, &text);
69+
clipboard_->ReadText(ui::ClipboardBuffer::kCopyPaste, &text);
7070
data.data.reset(new std::string(base::UTF16ToUTF8(text)));
7171
return true;
7272
}
@@ -76,23 +76,23 @@ namespace {
7676
base::string16 text;
7777
std::string src_url;
7878
uint32_t fragment_start, fragment_end;
79-
clipboard_->ReadHTML(ui::ClipboardType::kCopyPaste, &text, &src_url, &fragment_start, &fragment_end);
79+
clipboard_->ReadHTML(ui::ClipboardBuffer::kCopyPaste, &text, &src_url, &fragment_start, &fragment_end);
8080
data.data.reset(new std::string(base::UTF16ToUTF8(text)));
8181
return true;
8282
}
8383

8484
bool ReadRTF(ClipboardData& data) {
8585
DCHECK(data.type == TYPE_RTF);
8686
std::string text;
87-
clipboard_->ReadRTF(ui::ClipboardType::kCopyPaste, &text);
87+
clipboard_->ReadRTF(ui::ClipboardBuffer::kCopyPaste, &text);
8888
data.data.reset(new std::string(text));
8989
return true;
9090
}
9191

9292
bool ReadImage(ClipboardData& data) {
9393
DCHECK(data.type == TYPE_PNG || data.type == TYPE_JPEG);
9494
std::vector<unsigned char> encoded_image;
95-
SkBitmap bitmap = clipboard_->ReadImage(ui::ClipboardType::kCopyPaste);
95+
SkBitmap bitmap = clipboard_->ReadImage(ui::ClipboardBuffer::kCopyPaste);
9696

9797
if (bitmap.isNull()) {
9898
return true;
@@ -135,7 +135,7 @@ namespace {
135135
class ClipboardWriter {
136136
public:
137137
ClipboardWriter() {
138-
scw_.reset(new ui::ScopedClipboardWriter(ui::ClipboardType::kCopyPaste));
138+
scw_.reset(new ui::ScopedClipboardWriter(ui::ClipboardBuffer::kCopyPaste));
139139
}
140140

141141
~ClipboardWriter() {
@@ -292,7 +292,7 @@ NwClipboardClearSyncFunction::~NwClipboardClearSyncFunction() {
292292

293293
bool NwClipboardClearSyncFunction::RunNWSync(base::ListValue* response, std::string* error) {
294294
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
295-
clipboard->Clear(ui::ClipboardType::kCopyPaste);
295+
clipboard->Clear(ui::ClipboardBuffer::kCopyPaste);
296296
return true;
297297
}
298298

@@ -308,7 +308,7 @@ bool NwClipboardReadAvailableTypesFunction::RunNWSync(base::ListValue* response,
308308
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
309309
bool contains_filenames;
310310
std::vector<base::string16> types;
311-
clipboard->ReadAvailableTypes(ui::ClipboardType::kCopyPaste, &types, &contains_filenames);
311+
clipboard->ReadAvailableTypes(ui::ClipboardBuffer::kCopyPaste, &types, &contains_filenames);
312312
for(std::vector<base::string16>::iterator it = types.begin(); it != types.end(); it++) {
313313
if (base::EqualsASCII(*it, ui::kMimeTypeText)) {
314314
response->Append(base::WrapUnique(new base::Value(ToString(TYPE_TEXT))));

src/api/nw_object_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class NwObjCallObjectMethodSyncFunction : public NWSyncExtensionFunction {
7272
DISALLOW_COPY_AND_ASSIGN(NwObjCallObjectMethodSyncFunction);
7373
};
7474

75-
class NwObjCallObjectMethodAsyncFunction : public UIThreadExtensionFunction {
75+
class NwObjCallObjectMethodAsyncFunction : public ExtensionFunction {
7676
public:
7777
NwObjCallObjectMethodAsyncFunction();
7878

src/api/nw_screen_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace extensions {
104104
std::unique_ptr<base::ListValue> args) {
105105
DCHECK_CURRENTLY_ON(BrowserThread::UI);
106106
ExtensionsBrowserClient::Get()->BroadcastEventToRenderers(
107-
histogram_value, event_name, std::move(args));
107+
histogram_value, event_name, std::move(args), false);
108108
}
109109

110110
// Lazy initialize screen event listeners until first call

src/api/nw_shortcut_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace {
8080
std::unique_ptr<base::ListValue> args) {
8181
DCHECK_CURRENTLY_ON(BrowserThread::UI);
8282
ExtensionsBrowserClient::Get()->BroadcastEventToRenderers(
83-
histogram_value, event_name, std::move(args));
83+
histogram_value, event_name, std::move(args), false);
8484
}
8585

8686
base::LazyInstance<NWShortcutObserver>::Leaky

src/api/nw_window_api.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class ApiParameterExtractor {
148148
}
149149

150150
#if 0
151-
static Browser* getBrowser(UIThreadExtensionFunction* func) {
151+
static Browser* getBrowser(ExtensionFunction* func) {
152152
content::WebContents* web_contents = func->GetSenderWebContents();
153153
if (!web_contents) {
154154
return NULL;
@@ -158,7 +158,7 @@ static Browser* getBrowser(UIThreadExtensionFunction* func) {
158158
}
159159
#endif
160160

161-
static Browser* getBrowser(UIThreadExtensionFunction* func, int id) {
161+
static Browser* getBrowser(ExtensionFunction* func, int id) {
162162
Browser* browser = nullptr;
163163
std::string error;
164164
if (!windows_util::GetBrowserFromWindowID(
@@ -169,7 +169,7 @@ static Browser* getBrowser(UIThreadExtensionFunction* func, int id) {
169169
return browser;
170170
}
171171

172-
static AppWindow* getAppWindow(UIThreadExtensionFunction* func) {
172+
static AppWindow* getAppWindow(ExtensionFunction* func) {
173173
AppWindowRegistry* registry = AppWindowRegistry::Get(func->browser_context());
174174
DCHECK(registry);
175175
content::WebContents* web_contents = func->GetSenderWebContents();
@@ -856,8 +856,8 @@ ExtensionFunction::ResponseAction
856856
NwCurrentWindowInternalGetPrintersFunction::Run() {
857857
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
858858

859-
base::PostTaskWithTraitsAndReplyWithResult(
860-
FROM_HERE, {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
859+
base::PostTaskAndReplyWithResult(
860+
FROM_HERE, {base::ThreadPool(), base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
861861
base::Bind(&EnumeratePrintersAsync),
862862
base::Bind(&NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList,
863863
this));
@@ -920,7 +920,7 @@ bool NwCurrentWindowInternalGetCurrentFunction::RunNWSync(base::ListValue* respo
920920
: ExtensionTabUtil::kDontPopulateTabs;
921921
std::unique_ptr<base::DictionaryValue> windows =
922922
ExtensionTabUtil::CreateWindowValueForExtension(*browser, extension(),
923-
populate_tab_behavior);
923+
populate_tab_behavior, Feature::UNSPECIFIED_CONTEXT);
924924
response->Append(std::move(windows));
925925
return true;
926926
}

src/api/nw_window_api.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class WebContents;
1717
namespace extensions {
1818
class AppWindow;
1919

20-
class NwCurrentWindowInternalCloseFunction : public UIThreadExtensionFunction {
20+
class NwCurrentWindowInternalCloseFunction : public ExtensionFunction {
2121
public:
2222
NwCurrentWindowInternalCloseFunction() {}
2323
static void DoClose(AppWindow*);
@@ -32,7 +32,7 @@ class NwCurrentWindowInternalCloseFunction : public UIThreadExtensionFunction {
3232
};
3333

3434

35-
class NwCurrentWindowInternalShowDevToolsInternalFunction : public UIThreadExtensionFunction {
35+
class NwCurrentWindowInternalShowDevToolsInternalFunction : public ExtensionFunction {
3636
public:
3737
NwCurrentWindowInternalShowDevToolsInternalFunction() {}
3838

@@ -46,7 +46,7 @@ class NwCurrentWindowInternalShowDevToolsInternalFunction : public UIThreadExten
4646
void OnOpened();
4747
};
4848

49-
class NwCurrentWindowInternalShowDevTools2InternalFunction : public UIThreadExtensionFunction {
49+
class NwCurrentWindowInternalShowDevTools2InternalFunction : public ExtensionFunction {
5050
public:
5151
NwCurrentWindowInternalShowDevTools2InternalFunction() {}
5252

@@ -60,7 +60,7 @@ class NwCurrentWindowInternalShowDevTools2InternalFunction : public UIThreadExte
6060
void OnOpened();
6161
};
6262

63-
class NwCurrentWindowInternalCloseDevToolsFunction : public UIThreadExtensionFunction {
63+
class NwCurrentWindowInternalCloseDevToolsFunction : public ExtensionFunction {
6464
public:
6565
NwCurrentWindowInternalCloseDevToolsFunction() {}
6666

@@ -72,7 +72,7 @@ class NwCurrentWindowInternalCloseDevToolsFunction : public UIThreadExtensionFun
7272
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.closeDevTools", UNKNOWN)
7373
};
7474

75-
class NwCurrentWindowInternalCapturePageInternalFunction : public UIThreadExtensionFunction {
75+
class NwCurrentWindowInternalCapturePageInternalFunction : public ExtensionFunction {
7676
public:
7777
NwCurrentWindowInternalCapturePageInternalFunction();
7878

@@ -104,7 +104,7 @@ class NwCurrentWindowInternalCapturePageInternalFunction : public UIThreadExtens
104104
DISALLOW_COPY_AND_ASSIGN(NwCurrentWindowInternalCapturePageInternalFunction);
105105
};
106106

107-
class NwCurrentWindowInternalClearMenuFunction : public UIThreadExtensionFunction {
107+
class NwCurrentWindowInternalClearMenuFunction : public ExtensionFunction {
108108
public:
109109
NwCurrentWindowInternalClearMenuFunction();
110110

@@ -136,7 +136,7 @@ class NwCurrentWindowInternalSetMenuFunction : public NWSyncExtensionFunction {
136136
DISALLOW_COPY_AND_ASSIGN(NwCurrentWindowInternalSetMenuFunction);
137137
};
138138

139-
class NwCurrentWindowInternalSetShadowFunction : public UIThreadExtensionFunction {
139+
class NwCurrentWindowInternalSetShadowFunction : public ExtensionFunction {
140140
public:
141141
NwCurrentWindowInternalSetShadowFunction(){}
142142

@@ -151,7 +151,7 @@ class NwCurrentWindowInternalSetShadowFunction : public UIThreadExtensionFunctio
151151
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.setShadow", UNKNOWN)
152152
};
153153

154-
class NwCurrentWindowInternalSetBadgeLabelFunction : public UIThreadExtensionFunction {
154+
class NwCurrentWindowInternalSetBadgeLabelFunction : public ExtensionFunction {
155155
public:
156156
NwCurrentWindowInternalSetBadgeLabelFunction(){}
157157

@@ -163,7 +163,7 @@ class NwCurrentWindowInternalSetBadgeLabelFunction : public UIThreadExtensionFun
163163
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.setBadgeLabel", UNKNOWN)
164164
};
165165

166-
class NwCurrentWindowInternalRequestAttentionInternalFunction : public UIThreadExtensionFunction {
166+
class NwCurrentWindowInternalRequestAttentionInternalFunction : public ExtensionFunction {
167167
public:
168168
NwCurrentWindowInternalRequestAttentionInternalFunction(){}
169169

@@ -177,7 +177,7 @@ class NwCurrentWindowInternalRequestAttentionInternalFunction : public UIThreadE
177177
DISALLOW_COPY_AND_ASSIGN(NwCurrentWindowInternalRequestAttentionInternalFunction);
178178
};
179179

180-
class NwCurrentWindowInternalSetProgressBarFunction : public UIThreadExtensionFunction {
180+
class NwCurrentWindowInternalSetProgressBarFunction : public ExtensionFunction {
181181
public:
182182
NwCurrentWindowInternalSetProgressBarFunction(){}
183183

@@ -191,7 +191,7 @@ class NwCurrentWindowInternalSetProgressBarFunction : public UIThreadExtensionFu
191191
void Callback();
192192
};
193193

194-
class NwCurrentWindowInternalReloadIgnoringCacheFunction : public UIThreadExtensionFunction {
194+
class NwCurrentWindowInternalReloadIgnoringCacheFunction : public ExtensionFunction {
195195
public:
196196
NwCurrentWindowInternalReloadIgnoringCacheFunction() {}
197197

@@ -223,7 +223,7 @@ class NwCurrentWindowInternalSetZoomFunction : public NWSyncExtensionFunction {
223223
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.setZoom", UNKNOWN)
224224
};
225225

226-
class NwCurrentWindowInternalEnterKioskModeFunction : public UIThreadExtensionFunction {
226+
class NwCurrentWindowInternalEnterKioskModeFunction : public ExtensionFunction {
227227
public:
228228
NwCurrentWindowInternalEnterKioskModeFunction() {}
229229

@@ -235,7 +235,7 @@ class NwCurrentWindowInternalEnterKioskModeFunction : public UIThreadExtensionFu
235235
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.enterKioskMode", UNKNOWN)
236236
};
237237

238-
class NwCurrentWindowInternalLeaveKioskModeFunction : public UIThreadExtensionFunction {
238+
class NwCurrentWindowInternalLeaveKioskModeFunction : public ExtensionFunction {
239239
public:
240240
NwCurrentWindowInternalLeaveKioskModeFunction() {}
241241

@@ -247,7 +247,7 @@ class NwCurrentWindowInternalLeaveKioskModeFunction : public UIThreadExtensionFu
247247
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.leaveKioskMode", UNKNOWN)
248248
};
249249

250-
class NwCurrentWindowInternalToggleKioskModeFunction : public UIThreadExtensionFunction {
250+
class NwCurrentWindowInternalToggleKioskModeFunction : public ExtensionFunction {
251251
public:
252252
NwCurrentWindowInternalToggleKioskModeFunction() {}
253253

@@ -269,7 +269,7 @@ class NwCurrentWindowInternalIsKioskInternalFunction : public NWSyncExtensionFun
269269
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.isKioskInternal", UNKNOWN)
270270
};
271271

272-
class NwCurrentWindowInternalSetShowInTaskbarFunction : public UIThreadExtensionFunction {
272+
class NwCurrentWindowInternalSetShowInTaskbarFunction : public ExtensionFunction {
273273
public:
274274
NwCurrentWindowInternalSetShowInTaskbarFunction() {}
275275

@@ -321,7 +321,7 @@ class NwCurrentWindowInternalGetCurrentFunction : public NWSyncExtensionFunction
321321
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.getCurrent", UNKNOWN)
322322
};
323323

324-
class NwCurrentWindowInternalGetPrintersFunction : public UIThreadExtensionFunction {
324+
class NwCurrentWindowInternalGetPrintersFunction : public ExtensionFunction {
325325
public:
326326
NwCurrentWindowInternalGetPrintersFunction() {}
327327

src/api/shell/shell.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ namespace nw {
3838

3939
namespace {
4040

41-
void VerifyItemType(const FilePath &path, platform_util::OpenItemType *item_type) {
41+
bool VerifyItemType(const FilePath &path, platform_util::OpenItemType *item_type) {
4242
*item_type = base::DirectoryExists(path) ? platform_util::OPEN_FOLDER : platform_util::OPEN_FILE;
43+
return true;
4344
}
4445

45-
void OnItemTypeVerified(Profile* profile, const FilePath &path, const platform_util::OpenItemType *item_type) {
46+
void OnItemTypeVerified(Profile* profile, const FilePath &path, const platform_util::OpenItemType *item_type, bool result) {
4647
platform_util::OpenItem(profile, path,
4748
*item_type, platform_util::OpenOperationCallback());
4849
}
@@ -63,9 +64,9 @@ void Shell::Call(const std::string& method,
6364
arguments.GetString(0, &full_path);
6465
FilePath path = FilePath::FromUTF8Unsafe(full_path);
6566
platform_util::OpenItemType *item_type = new platform_util::OpenItemType();
66-
base::PostTaskWithTraitsAndReply(
67+
base::PostTaskAndReplyWithResult(
6768
FROM_HERE,
68-
{base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
69+
{base::ThreadPool(), base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
6970
base::Bind(&VerifyItemType, path, base::Unretained(item_type)),
7071
base::Bind(&OnItemTypeVerified, profile, path, base::Owned(item_type))
7172
);

src/browser/nw_chrome_browser_hooks.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "components/crx_file/id_util.h"
3030

3131
// content
32-
#include "content/common/dom_storage/dom_storage_map.h"
32+
//#include "content/common/dom_storage/dom_storage_map.h"
3333
//#include "content/browser/dom_storage/dom_storage_area.h"
3434
#include "content/nw/src/common/shell_switches.h"
3535
#include "content/public/browser/browser_thread.h"
@@ -266,7 +266,7 @@ int MainPartsPreCreateThreadsHook() {
266266
command_line->AppendSwitchPath("nwapp", path);
267267
int dom_storage_quota_mb;
268268
if (package->root()->GetInteger("dom_storage_quota", &dom_storage_quota_mb)) {
269-
content::DOMStorageMap::SetQuotaOverride(dom_storage_quota_mb * 1024 * 1024);
269+
//content::DOMStorageMap::SetQuotaOverride(dom_storage_quota_mb * 1024 * 1024);
270270
}
271271

272272
#if 0

src/nw_content_verifier_delegate.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ NWContentVerifierDelegate::NWContentVerifierDelegate(
9999
NWContentVerifierDelegate::~NWContentVerifierDelegate() {
100100
}
101101

102-
bool NWContentVerifierDelegate::ShouldBeVerified(
102+
ContentVerifierDelegate::VerifierSourceType NWContentVerifierDelegate::GetVerifierSourceType(
103103
const Extension& extension) {
104104

105105
if (extension.is_nwjs_app() && !Manifest::IsComponentLocation(extension.location()))
106-
return default_mode_ != NONE;
106+
return default_mode_ != NONE ? VerifierSourceType::SIGNED_HASHES : VerifierSourceType::NONE;
107107
if (!extension.is_extension() && !extension.is_legacy_packaged_app())
108-
return false;
108+
return VerifierSourceType::NONE;
109109
if (!Manifest::IsAutoUpdateableLocation(extension.location()))
110-
return false;
110+
return VerifierSourceType::NONE;
111111

112-
return default_mode_ != NONE;
112+
return default_mode_ != NONE ? VerifierSourceType::SIGNED_HASHES : VerifierSourceType::NONE;
113113
}
114114

115115
ContentVerifierKey NWContentVerifierDelegate::GetPublicKey() {
@@ -139,7 +139,7 @@ void NWContentVerifierDelegate::VerifyFailed(
139139
if (!extension)
140140
return;
141141
ExtensionSystem* system = ExtensionSystem::Get(context_);
142-
if (ShouldBeVerified(*extension)) {
142+
if (GetVerifierSourceType(*extension) != ContentVerifierDelegate::VerifierSourceType::NONE) {
143143
LoadErrorReporter::GetInstance()->
144144
ReportLoadError(extension->path(), "Extension file corrupted: " + relative_path.AsUTF8Unsafe(),
145145
system->extension_service()->profile(), true);

src/nw_content_verifier_delegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NWContentVerifierDelegate : public ContentVerifierDelegate {
4141
~NWContentVerifierDelegate() override;
4242

4343
// ContentVerifierDelegate:
44-
bool ShouldBeVerified(const Extension& extension) override;
44+
VerifierSourceType GetVerifierSourceType(const Extension& extension) override;
4545
ContentVerifierKey GetPublicKey() override;
4646
GURL GetSignatureFetchUrl(const std::string& extension_id,
4747
const base::Version& version) override;

0 commit comments

Comments
 (0)