Skip to content

Commit d682eb8

Browse files
committed
Merge branch 'nw27' into nw28
2 parents 865a448 + 2b7d2db commit d682eb8

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

docs/For Users/Debugging with DevTools.md

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

99
DevTools can be opened with keyboard shortcut <kbd>F12</kbd> on Windows and Linux or <kbd>&#8984;</kbd>+<kbd>&#8997;</kbd>+<kbd>i</kbd> on Mac.
1010

11-
Alternatively, you may open DevTools programmatically using NW.js API [win.showDevTools()`](../References/Window.md##winshowdevtoolsiframe-headless-callback) for a window.
11+
Alternatively, you may open DevTools programmatically using NW.js API [win.showDevTools()](../References/Window.md#winshowdevtoolsiframe-callback) for a window.
1212

1313
## Node.js Modules Debugging
1414

docs/References/Clipboard.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ clipboard.clear();
3636
* `type` `{String}` _Optional_ the type of the data. Support `text`, `png`, `jpeg`, `html` and `rtf`. By default, `type` is set to `"text"`.
3737
* `raw` `{Boolean}` _Optional_ requiring raw image data. This option is only valid if type is `png` or `jpeg`. By default, `raw` is set to `false`.
3838

39-
Write `data` of `type` to the clipboard. This method will clear the clipboard and replace with the given `data`. Hence another call to this method will overwrite with the new one. To write multiple types of data to clipboard simultaneously, you will need to use [clip.set(clipboardDataList)](clipsetclipboardDataList) below.
39+
Write `data` of `type` to the clipboard. This method will clear the clipboard and replace with the given `data`. Hence another call to this method will overwrite with the new one. To write multiple types of data to clipboard simultaneously, you will need to use [clip.set(clipboardDataList)](#clipsetclipboarddatalist) below.
4040

4141
!!! tip "Format of Image"
4242
Images read or written from clipboard can be either JPEG or PNG. When `raw` is not set or set to `false`, the data is expected to be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs) encoded with Base64. When `raw` is set to `true`, the data is only the Base64 encoded image data not including the `data:<mime-type>;base64,` part.
@@ -47,7 +47,7 @@ Write `data` of `type` to the clipboard. This method will clear the clipboard an
4747

4848
## clip.set(clipboardDataList)
4949

50-
* `clipboardDataList` `{Array}` Array of `clipboardData` to be written to clipboard. See [clip.set(clipboardData)](#clipsetclipboardData) and [clip.set(data, [type, [raw]])](#clipsetdata-type-raw) for detailed arguments specification.
50+
* `clipboardDataList` `{Array}` Array of `clipboardData` to be written to clipboard. See [clip.set(clipboardData)](#clipgetclipboarddata) and [clip.set(data, [type, [raw]])](#clipsetdata-type-raw) for detailed arguments specification.
5151

5252
Multiple types of data can be written to clipboard simultaneously with this method.
5353

@@ -87,12 +87,12 @@ Get the data of `type` from clipboard.
8787

8888
## clip.get(clipboardDataList)
8989

90-
* `clipboardDataList` `{Array}` Array of `clipboardData` for reading data from clipboard. Multiple types of data can be read from clipboard simultaneously with this method. See [clip.get(clipboardData)](#clipgetclipboardData) and [clip.get([type, [raw]])](#clipgettype-raw) for detailed arguments specification.
90+
* `clipboardDataList` `{Array}` Array of `clipboardData` for reading data from clipboard. Multiple types of data can be read from clipboard simultaneously with this method. See [clip.get(clipboardData)](#clipgetclipboarddata) and [clip.get([type, [raw]])](#clipgettype-raw) for detailed arguments specification.
9191
* Returns `{Array}` array of `clipboardData` retrieved from the clipboard. Each item contains `type`, `data` and `raw` (optional) attributes.
9292

9393
## clip.readAvailableTypes()
9494

95-
* Returns `{Array}` list of available types of data in clipboard currenly. Each item is one of following types:
95+
* Returns `{Array}` list of available types of data in clipboard currently. Each item is one of following types:
9696
- `text`: plain text. Can be read by `clip.get('text')`.
9797
- `html`: HTML text. Can be read by `clip.get('html')`.
9898
- `rtf`: RTF (Rich Text Format). Can be read by `clip.get('rtf')`.

src/browser/nw_extensions_browser_hooks.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
3131
#include "extensions/common/manifest_constants.h"
3232
#include "extensions/common/manifest_handlers/webview_info.h"
33+
#include "extensions/common/manifest_url_handlers.h"
3334

3435
#if defined(OS_WIN)
3536
#define _USE_MATH_DEFINES
@@ -204,10 +205,25 @@ bool RphGuestFilterURLHook(RenderProcessHost* rph, const GURL* url) {
204205
typedef bool (*RphGuestFilterURLHookFn)(content::RenderProcessHost* rph, const GURL* url);
205206
CONTENT_EXPORT extern RphGuestFilterURLHookFn gRphGuestFilterURLHook;
206207

208+
bool GuestSwapProcessHook(content::BrowserContext* browser_context, const GURL& url) {
209+
if (!url.SchemeIs("chrome-extension"))
210+
return false;
211+
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context);
212+
std::string extension_id = url.host();
213+
const Extension* extension = registry->enabled_extensions().GetByID(extension_id);
214+
if (extension && !extensions::ManifestURL::Get(extension, "devtools_page").is_empty())
215+
return true;
216+
return false;
217+
}
218+
219+
typedef bool(*GuestSwapProcessHookFn)(content::BrowserContext*, const GURL& url);
220+
CONTENT_EXPORT extern GuestSwapProcessHookFn gGuestSwapProcessHook;
221+
207222
void LoadNWAppAsExtensionHook(base::DictionaryValue* manifest,
208223
const base::FilePath& extension_path,
209224
std::string* error) {
210225
gRphGuestFilterURLHook = RphGuestFilterURLHook;
226+
gGuestSwapProcessHook = GuestSwapProcessHook;
211227
if (!manifest)
212228
return;
213229

0 commit comments

Comments
 (0)