Compare commits

...

594 Commits

Author SHA1 Message Date
Zeke Sikelianos
147addbce1 Bump v1.4.4 2016-10-20 09:17:29 +09:00
Kevin Sawicki
104f8d6057 Merge pull request #7659 from electron/jacob/ally
Fire a11y event on touch screens using screen readers
2016-10-18 13:41:48 +09:00
Jacob Groundwater
9c9ba80978 Fire a11y event on touch screens using screen readers 2016-10-18 13:28:32 +09:00
Cheng Zhao
cbe9768529 Merge pull request #7566 from electron/always-shorten-path
Shorten Socket path for makeSingleInstance in sandboxed apps
2016-10-17 20:43:51 +08:00
Cheng Zhao
ce847fc3ca Merge pull request #7578 from electron/windows-logging
Show console output from Windows when ELECTRON_RUN_AS_NODE is set
2016-10-17 20:22:39 +08:00
Kevin Sawicki
3dd8377218 Merge pull request #7611 from electron/only-enable-msaa-if-needed
Check harder before enabling Accessibility support on Win32
2016-10-14 12:46:32 -07:00
Paul Betts
6fdf40b038 Code Cleanup 2016-10-14 12:17:32 -07:00
Kevin Sawicki
988e2334f5 Merge pull request #7614 from tinydew4/translate-ko
[ko] Apply the changes till the '9367c76' commit.
2016-10-14 09:19:04 -07:00
tinydew4
741ae488d5 Apply the changes till the '9367c76' commit. 2016-10-14 02:24:27 +00:00
Kevin Sawicki
a13ed2a005 Merge pull request #7610 from LShun/patch-1
Word addition and revision for Readme,md
2016-10-13 14:18:56 -07:00
Kevin Sawicki
9367c764be Merge pull request #7608 from nabeelomer/master
Add further information to online-offline event documentation
2016-10-13 14:17:07 -07:00
Kevin Sawicki
4f57b685bd Add backticks around true/false values 2016-10-13 14:16:37 -07:00
Kevin Sawicki
902a8c57bd Merge pull request #7602 from danburzo/cli_switches_docs
Docs: Command-line switches -- note about node.js flags, added debug flags
2016-10-13 14:13:08 -07:00
Kevin Sawicki
21cfd330c0 Switch from node man to node --help 2016-10-13 14:11:56 -07:00
Long Nhat Nguyen
c017a7a1c7 Update url (#7598)
* Update EventEmitter URL

* Update EventEmitter URL

* Enable click

* Update EventEmitter URL

* Update EventEmitter URL

* Update URL

* Update URL

* Update EventEmitter URL

* Tweak sentence and add perios
2016-10-13 14:09:14 -07:00
Kevin Sawicki
0756aa663b Merge pull request #7587 from electron/update-standard
Update standard to v8 to be inline with standard-markdown
2016-10-13 14:04:24 -07:00
Kevin Sawicki
4ee94917a0 Merge pull request #7576 from tinydew4/translate-ko
Apply the changes of docs on ko-KR
2016-10-13 13:56:39 -07:00
Paul Betts
0df21afcdf Check harder before enabling Accessibility support 2016-10-13 11:46:55 -07:00
LShun
433a825006 Word addition and revision for Readme,md
I edited some words as well as added some information ( for example the License ) that was missing in the translation but found in the main site README.md,
2016-10-13 22:58:48 +08:00
Nabeel Omer
4f288e3ba2 Update 2016-10-13 20:22:40 +05:30
Nabeel Omer
392b59be4e Made relevant changes 2016-10-13 20:12:44 +05:30
Nabeel Omer
6d8d211631 Update online-offline-events.md 2016-10-13 19:45:39 +05:30
Dan Burzo
af17253a72 Changed link to Node docs in MD reference format 2016-10-13 13:03:29 +03:00
Dan Burzo
cfdea04c83 Added note about sending flags to Node.js, additional debug flags 2016-10-13 12:54:22 +03:00
Zeke Sikelianos
7584e73d70 Merge pull request #7580 from electron/docs-linter-rectangle-rename
Update docs linter with Rectangle structure fixes
2016-10-12 19:06:44 -07:00
Samuel Attard
eac5ba4c56 Fix spec linting issues 2016-10-13 12:47:43 +11:00
Samuel Attard
a9d5699a52 Update standard to v8 to be inline with standard-markdown 2016-10-13 12:46:00 +11:00
tinydew4
4e08264522 Apply the changes on early Oct 13, 2016 2016-10-13 00:49:20 +00:00
tinydew4
6b39e4a210 Apply the changes about #7379 to ko_KR 2016-10-13 00:34:39 +00:00
tinydew4
4a1c8f6cb7 Apply the changes 2016-10-13 00:33:12 +00:00
tinydew4
468d5f6c7a Apply the changes on Oct 12, 2016 2016-10-13 00:32:05 +00:00
Kevin Sawicki
a8382d6794 Moving atom_bindings include to Windows block 2016-10-12 13:48:49 -07:00
Kevin Sawicki
e899050500 Add basic test of spawned ELECTRON_RUN_AS_NODE process 2016-10-12 13:48:49 -07:00
Kevin Sawicki
b01fd9715b Only expose process.log on Windows 2016-10-12 13:48:48 -07:00
Kevin Sawicki
0417a3e51e Upgrade node for process logging fix patch 2016-10-12 13:48:48 -07:00
Kevin Sawicki
0740b2f66b Reuse Log method 2016-10-12 13:48:48 -07:00
Kevin Sawicki
d686916fe2 Expose process.log when running as node 2016-10-12 13:48:48 -07:00
Kevin Sawicki
fefc7c23f9 Merge pull request #7479 from bpasero/process-no-asar
Introduce ELECTRON_NO_ASAR
2016-10-12 13:48:03 -07:00
Kevin Sawicki
cef7525d00 Merge pull request #7583 from torn4dom4n/master
Update devDependency Status URL
2016-10-12 13:20:16 -07:00
Long Nhat Nguyen
b448b0c796 Update devDependency Status URL
[ci skip]
2016-10-12 20:17:26 +00:00
Kevin Sawicki
a97dc6d17a Merge pull request #7570 from preco21/korean-docs-12
docs: Update Korean docs as upstream and small improves
2016-10-12 13:06:02 -07:00
Kevin Sawicki
fcfc13c1ea Merge pull request #7579 from electron/tweak-about-panel-key-names
Use lower-case about panel option keys
2016-10-12 11:32:01 -07:00
Kevin Sawicki
1e4ef195bb Use lower-case about panel option keys 2016-10-12 11:18:21 -07:00
Kevin Sawicki
566d76def2 Mention spawning with ELECTRON_RUN_AS_NODE 2016-10-12 11:11:27 -07:00
Kevin Sawicki
f553d16539 Only support ELECTRON_NO_ASAR in non browser/renderer processes 2016-10-12 11:11:27 -07:00
Kevin Sawicki
8897a7a926 Add specs for ELECTRON_NO_ASAR env var 2016-10-12 11:11:27 -07:00
Benjamin Pasero
656ee0d9c3 introduce ELECTRON_NO_ASAR 2016-10-12 11:11:27 -07:00
Zeke Sikelianos
ecc03fdd40 update docs linter with Rectangle structure fixes 2016-10-12 11:04:53 -07:00
Cheng Zhao
46cd8708a4 Merge pull request #7561 from electron/windows-system-colors
Support retrieving Windows system colors
2016-10-12 15:35:18 +09:00
Zeke Sikelianos
27e1938e9f Merge pull request #7471 from electron/update-standard-markdown
Use standard style JavaScript in all docs translations
2016-10-11 22:37:54 -07:00
Zeke Sikelianos
17198c26d9 update standard-markdown 2016-10-11 22:37:32 -07:00
Zeke Sikelianos
eaeebd3ebd use newer function syntax 2016-10-11 22:37:32 -07:00
Zeke Sikelianos
253a383168 standardize docs-translations by hand 2016-10-11 22:37:32 -07:00
Zeke Sikelianos
3e4a0705e9 standardize docs 2016-10-11 22:37:32 -07:00
Zeke Sikelianos
7ef374477d lint docs-translations with standard-markdown 2016-10-11 22:36:11 -07:00
Zeke Sikelianos
4ae6103356 auto-standardize javascript in docs-translations 2016-10-11 22:36:11 -07:00
Zeke Sikelianos
2e4322c230 update to new standard-markdown with --fix feature 2016-10-11 22:36:11 -07:00
Zeke Sikelianos
6b7e375963 Merge pull request #7379 from electron/seperate-structs
Move reused object structures to a standard structures folder
2016-10-11 22:28:39 -07:00
Zeke Sikelianos
c46c1dbb1e Merge pull request #7505 from electron/testing-docs
Update test dependencies and documentation
2016-10-11 22:28:16 -07:00
Plusb Preco
af79f4793e 📝 Improve grammar
[ci skip]
2016-10-12 12:24:21 +09:00
Plusb Preco
774a15f4c8 📝 Improve grammar
[ci skip]

* Use `formal` tense.
* Small fixes.
2016-10-12 12:24:14 +09:00
Plusb Preco
b7c4cde11a 📝 Adjust line wrap to 80
[ci skip]
2016-10-12 12:13:59 +09:00
Plusb Preco
9857aa25a3 📝 Update Korean docs as upstream
[ci skip]
2016-10-12 12:02:04 +09:00
Zeke Sikelianos
d4a8a64ba7 Merge pull request #7498 from electron/custom-props-in-menu-item-constructor
Preserve custom properties passed to MenuItem constructor
2016-10-11 14:24:13 -07:00
Zeke Sikelianos
af0098f064 remove badge count after each setBadgeCount test 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
37c53f2e09 clarify mocha test exclusion 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
a8e59ccd3d fix links to testing docs 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
57852366bb mention building before testing 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
a4832c304e unify testing docs for all platforms 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
156d823b7f remove badge after setBadgeCount test finishes 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
45d9cc6405 update test dependencies 2016-10-11 14:22:48 -07:00
Zeke Sikelianos
0aeb53435e add tips for testing 2016-10-11 14:22:48 -07:00
Paul Betts
7dd1ebc734 Fix oops typos 2016-10-11 14:02:29 -07:00
Kevin Sawicki
ce694760bc Remove const since SkColor is an int 2016-10-11 13:15:27 -07:00
Kevin Sawicki
c8189046fe Emit color-changed event on Windows 2016-10-11 13:15:27 -07:00
Kevin Sawicki
2656812dea Doc systemPreferences.getColor 2016-10-11 13:15:27 -07:00
Kevin Sawicki
1978b39337 Remove duplicate colors 2016-10-11 13:15:27 -07:00
Kevin Sawicki
e7bfd1c959 Add systemPreferences.getColor specs 2016-10-11 13:15:26 -07:00
Kevin Sawicki
663f8f4b54 Add systemPreferences.getColor on Windows 2016-10-11 13:15:26 -07:00
Kevin Sawicki
9b0a32f62c Add ToRGBHex color helper 2016-10-11 13:15:26 -07:00
Paul Betts
06065d1c5d Instead of gating the path shortening to MAS_BUILD, figure it out at runtime 2016-10-11 13:06:29 -07:00
Paul Betts
e84ae6e2aa Add a method to determine whether we're in the Apple sandbox 2016-10-11 13:06:29 -07:00
Kevin Sawicki
13f9a6c273 Merge pull request #7563 from rogerlista/master
📝 Translation of security.md to pt-BR [ci skip]
2016-10-11 10:06:02 -07:00
Rogério
d89b23c120 📝 Translation of security.md to pt-BR [ci skip] 2016-10-11 14:01:07 -03:00
Kevin Sawicki
479451e7c7 Merge pull request #7562 from odedhb/patch-1
Update mac-app-store-submission-guide.md
2016-10-11 10:00:56 -07:00
Oded Breiner
ea8a4f2b51 Update mac-app-store-submission-guide.md 2016-10-11 19:58:53 +03:00
Kevin Sawicki
e26189ba87 Merge pull request #7560 from electron/upgrade-brigthray
Upgrade brightray for devtools dock state preference fix
2016-10-11 09:48:39 -07:00
Kevin Sawicki
003522d6f7 Merge pull request #7558 from danburzo/build_instructions
Adds link to PyObjC installation instructions
2016-10-11 09:48:20 -07:00
Kevin Sawicki
4db6ccd579 Merge pull request #7555 from tinydew4/translate-ko
Apply the changes of docs to ko-KR
2016-10-11 09:47:51 -07:00
Kevin Sawicki
39aa740c88 Merge pull request #7552 from electron/fix-menu-docs
fix Menu API example
2016-10-11 09:47:30 -07:00
Kevin Sawicki
66f825beb1 Upgrade brightray for devtools dock state preference fix 2016-10-11 08:45:42 -07:00
Dan Burzo
75feeca0f0 Small fix to grammar in Build instructions (macOS) 2016-10-11 17:41:28 +03:00
Dan Burzo
120aa1c9ce Adds link to PyObjC installation instructions 2016-10-11 17:34:35 +03:00
tinydew4
7fa2ffc2a7 Apply the changes on Oct 11, 2016 2016-10-11 12:25:34 +00:00
tinydew4
15fae91ac7 Apply changes about crash-reporter 2016-10-11 12:06:32 +00:00
Cheng Zhao
4ae190dab9 Merge pull request #7549 from electron/about-panel-options
Support setting about panel options
2016-10-11 20:18:23 +09:00
Cheng Zhao
0baa60caab Merge pull request #7528 from electron/key-and-code-on-sent-input-events
Set key and code on sendInputEvent keyboard events
2016-10-11 19:34:05 +09:00
Cheng Zhao
2a3bcdcaab Merge pull request #7518 from electron/inverted-color-scheme
Support detecting inverted color scheme on Windows
2016-10-11 19:31:34 +09:00
Zeke Sikelianos
619f74fa12 fix Menu example 2016-10-10 23:01:35 -07:00
Zeke Sikelianos
8aaf029e55 remove unused var 2016-10-10 15:38:27 -07:00
Zeke Sikelianos
bcce7aff18 test that overrideProperty is not overwritten 2016-10-10 15:25:56 -07:00
Zeke Sikelianos
b575055d7e inherit user-specific MenuItem properties more safely 2016-10-10 14:40:49 -07:00
Kevin Sawicki
d5b3ef5380 Merge pull request #7548 from malept/electron-packager-mas-doc-fix
Docs: clarify ignoring object files with electron-packager
2016-10-10 13:50:41 -07:00
Kevin Sawicki
58ef0bea17 Doc app.setAboutPanelOptions 2016-10-10 13:40:57 -07:00
Kevin Sawicki
7de6a06acf Support setting about panel options 2016-10-10 13:30:58 -07:00
Zeke Sikelianos
2cd10d339f remove duplicated prop copying 2016-10-10 11:07:01 -07:00
Kevin Sawicki
38281f3364 Implement SysColorChangeListener directly on Windows 2016-10-10 10:43:09 -07:00
Kevin Sawicki
25bcc2dd0d 🎨 2016-10-10 10:43:09 -07:00
Kevin Sawicki
af27c62b07 Doc inverted-color-scheme-changed event 2016-10-10 10:43:08 -07:00
Kevin Sawicki
8b16b82ce9 Add inverted-color-scheme-changed event 2016-10-10 10:43:08 -07:00
Kevin Sawicki
223e9d97a0 Doc systemPreferences.isInvertedColorScheme 2016-10-10 10:43:08 -07:00
Kevin Sawicki
7b49d94e9f Add systemPreferences.isInvertedColorScheme API 2016-10-10 10:43:08 -07:00
Mark Lee
a677eb0f95 📝 clarify ignoring object files with electron-packager
Note that Electron Packager 8.1.0 ignores object files by default.
2016-10-10 13:08:36 -04:00
Kevin Sawicki
987579d391 Send initial keyDown before char event 2016-10-10 09:35:44 -07:00
Kevin Sawicki
99414065a9 Add char/keypress event tests 2016-10-10 09:35:44 -07:00
Kevin Sawicki
e4b0577cb0 Assert key and code in keyup input event spec 2016-10-10 09:35:44 -07:00
Kevin Sawicki
424afd3faf Update expected key and code values 2016-10-10 09:35:43 -07:00
Kevin Sawicki
6fac14ad3f Set key and code on keyboard events 2016-10-10 09:35:43 -07:00
Kevin Sawicki
d69367aa9b Add keydown sendInputEvent specs 2016-10-10 09:35:43 -07:00
Kevin Sawicki
2efb7a12cb Merge pull request #7544 from tinydew4/fix-docs
Fix dot
2016-10-10 09:19:13 -07:00
Kevin Sawicki
9f616b934b Merge pull request #7542 from Menq/patch-1
update
2016-10-10 09:18:41 -07:00
Kevin Sawicki
c016e83eb3 Merge pull request #7541 from tinydew4/translate-ko
Translate clang-format
2016-10-10 09:18:23 -07:00
Kevin Sawicki
7015dbf0d2 Merge pull request #7536 from rogerlista/master
📝 Translation of faq.md to pt-BR [ci skip]
2016-10-10 09:18:02 -07:00
tinydew4
9f42c4c441 Fix dot 2016-10-10 14:31:05 +00:00
孟强
1841f826fe update
rename electron-prebuild to electron
2016-10-10 17:08:26 +08:00
Cheng Zhao
e24267d060 Update brightray for #7503 2016-10-10 11:35:59 +09:00
Cheng Zhao
91591f37e6 Merge pull request #7500 from electron/store-crashes-in-configured-temp-dir
Store crash reports in configured temp dir
2016-10-10 10:19:02 +09:00
tinydew4
8875296338 Translate clang-format.md 2016-10-10 00:53:13 +00:00
Rogério
98eb8cd3c1 📝 Translation of faq.md to pt-BR [ci skip] 2016-10-09 10:56:55 -03:00
Zeke Sikelianos
2acd7f4d12 fix NativeImage link path 2016-10-07 21:25:39 -07:00
Samuel Attard
4d49156dac Rename bounds -> rectangle 2016-10-08 13:09:31 +11:00
Kevin Sawicki
c147e72c8e Merge pull request #7499 from electron/clang-format
Add a guide to use clang-format
2016-10-07 14:06:18 -07:00
Kevin Sawicki
f872799f5c Minor edits to clang-format guide 2016-10-07 14:05:33 -07:00
Kevin Sawicki
913bc8e198 Merge pull request #7527 from electron/only-set-global-app-name-on-audio-manager-on-linux
Only call media::AudioManager::SetGlobalAppName on Linux
2016-10-07 14:04:03 -07:00
Kevin Sawicki
c37740273f Add linux guard for SetGlobalAppName call 2016-10-07 13:44:54 -07:00
Kevin Sawicki
f09ed4b677 Merge pull request #7524 from deepak1556/pa_app_name_patch
media: set the application name for audio streams shown in external apps
2016-10-07 10:15:35 -07:00
Kevin Sawicki
e52f5933a0 Merge pull request #7522 from tinydew4/translate-ko
Add REPL doc in ko-KR and apply other changes
2016-10-07 10:11:24 -07:00
Kevin Sawicki
9339853448 Merge pull request #7520 from electron/fix-undef-webprefs
Default webPreferences to empty object always
2016-10-07 10:10:40 -07:00
deepak1556
12fb9f1f18 media: set the application name for audio streams shown in external apps 2016-10-07 16:15:30 +05:30
tinydew4
f3b182606b Add REPL doc in ko-KR and apply other changes 2016-10-07 08:34:27 +00:00
Samuel Attard
a0284a9bc5 Add spec for window.open with webPreferences set to null 2016-10-07 12:13:04 +11:00
Samuel Attard
09e5035ab5 Default webPreferences to empty object always 2016-10-07 11:45:13 +11:00
Zeke Sikelianos
b7e078e98d sanitize MenuItem options 2016-10-06 14:37:13 -07:00
Zeke Sikelianos
f80e81bf9f standardize 2016-10-06 12:20:00 -07:00
Zeke Sikelianos
c34d868609 update docs-linter 2016-10-06 12:20:00 -07:00
Samuel Attard
2b05c61ae3 Update docs for parsing 2016-10-06 12:19:38 -07:00
Samuel Attard
b859afc118 Update docs to follow the 'link first instance' standard 2016-10-06 12:19:38 -07:00
Samuel Attard
03979936f3 Move reused object structures to a standard structures folder 2016-10-06 11:59:42 -07:00
Kevin Sawicki
4d7050553c Merge pull request #7449 from amtj/repl-docs
add REPL documentation
2016-10-06 11:38:48 -07:00
Kevin Sawicki
c104858079 Update Node.js docs link and Windows note 2016-10-06 11:38:09 -07:00
Kevin Sawicki
2c8781ed69 Merge pull request #7511 from tinydew4/translate-ko
Update korean docs
2016-10-06 11:12:26 -07:00
Kevin Sawicki
e38fc724f8 Merge pull request #7508 from miniak/docs-fix
Add missing documentation
2016-10-06 11:11:31 -07:00
Kevin Sawicki
3bbfc4d420 Merge pull request #7507 from toonborgers/translate-nl
Add link to dutch translation in CONTRIBUTING.md [ci skip]
2016-10-06 11:06:18 -07:00
Kevin Sawicki
217010a669 Merge pull request #7515 from electron/newline-before-list
Add newline before list
2016-10-06 11:03:52 -07:00
Kevin Sawicki
451cea4675 Add newline before list 2016-10-06 11:02:30 -07:00
Kevin Sawicki
d39182b41a Pass crashes directory instead of product name and temp dir 2016-10-06 10:55:11 -07:00
Zeke Sikelianos
2cda2bd718 Merge pull request #7502 from squarejaw/patch-1
Fix misspelling in docs/api/app.md
2016-10-06 10:44:11 -07:00
Kevin Sawicki
16e3991ffa Guard against app.getPath throwing with OS fallback 2016-10-06 10:07:40 -07:00
Kevin Sawicki
fbbffe03a5 Add getPath specs 2016-10-06 09:57:25 -07:00
Kevin Sawicki
f61ace74bb Sort includes 2016-10-06 09:50:06 -07:00
Kevin Sawicki
4a8dcec63a Wait for crash report to become available 2016-10-06 09:47:07 -07:00
Kevin Sawicki
30c6ca6751 Only call UTF8ToUTF16 on Windows 2016-10-06 09:14:16 -07:00
Kevin Sawicki
84b7bb29f0 Fix Windows compiler errors 2016-10-06 09:02:03 -07:00
Kevin Sawicki
9d1d1f21e9 Use FilePath for crash reporter temp directory 2016-10-06 09:02:03 -07:00
Kevin Sawicki
883c4b63d0 temp_path -> temp_dir 2016-10-06 09:02:02 -07:00
Kevin Sawicki
0380d3ae50 Pass crashes directory to crash service process 2016-10-06 09:02:02 -07:00
Kevin Sawicki
2fbb98a97c Remove directory assert 2016-10-06 09:02:02 -07:00
Kevin Sawicki
43702e0f8e Support calling getUploadedReports on unstarted crash reporter 2016-10-06 09:02:02 -07:00
Kevin Sawicki
56d9ce34e4 Use valid Linux report id 2016-10-06 09:02:02 -07:00
Kevin Sawicki
76abb2e18d Add missing temp_dir arg to override 2016-10-06 09:02:02 -07:00
Kevin Sawicki
a0db484510 Use app.getPath directly for temp path 2016-10-06 09:02:02 -07:00
Kevin Sawicki
b3b856f476 Set productName in main process on Linux 2016-10-06 09:02:02 -07:00
Kevin Sawicki
69a7025c96 Fix Linux compiler errors 2016-10-06 09:02:01 -07:00
Kevin Sawicki
773bfea386 Remove unused rimraf spec dependency 2016-10-06 09:02:01 -07:00
Kevin Sawicki
eafc694bba Mention crash report locations 2016-10-06 09:02:01 -07:00
Kevin Sawicki
81733a523e DRY up temp directory logging 2016-10-06 09:02:01 -07:00
Kevin Sawicki
1afe501a36 Add tests for crash reports in custom temp directory 2016-10-06 09:02:01 -07:00
Kevin Sawicki
f282b51c98 🎨 Use ES6 class, destructuring, and let/const 2016-10-06 09:02:01 -07:00
Kevin Sawicki
ac0658bbf1 Use PathService for temp dir path for crashes 2016-10-06 09:02:01 -07:00
tinydew4
116dbc0581 Update ko docs 2016-10-06 14:53:57 +00:00
tinydew4
6af8a0fae4 Update ko docs 2016-10-06 14:27:48 +00:00
tinydew4
79b5ae3d57 Modify docs to refelect the latest 2016-10-06 14:27:48 +00:00
Milan Burda
cb15181f43 Fix typo 2016-10-06 12:03:37 +02:00
Milan Burda
9f342ebbd1 Add missing documentation 2016-10-06 11:30:34 +02:00
Toon Borgers
27795015ff Add link to dutch translation in CONTRIBUTING.md 2016-10-06 10:56:59 +02:00
Cheng Zhao
79a5de3fd8 Bump v1.4.3 2016-10-06 17:12:07 +09:00
Cheng Zhao
2624738534 Lock the version of electron-docs-linter 2016-10-06 17:12:06 +09:00
Cheng Zhao
10b91b1291 Merge pull request #7488 from electron/native-image-resize-and-crop
Support resizing and cropping native images
2016-10-06 15:01:41 +09:00
Cheng Zhao
1781ceb25b Merge pull request #7494 from thomsonreuters/Update_Test_For_Missing_Additional_Features
Update BrowserWindow's test to check additional features upon window.open() call
2016-10-06 14:45:28 +09:00
Cheng Zhao
051e5c27b3 Update brightray for #7332 2016-10-06 14:42:14 +09:00
Cheng Zhao
5285b729be Merge pull request #7407 from thomsonreuters/New_Window_Handler_Can_Create_And_Return_Window
New-window event handler can return its own BrowserWindow instance
2016-10-06 14:37:48 +09:00
Bryan Bess
9bc6000cb5 📝 Fix misspelling in docs/api/app.md [ci skip] 2016-10-05 19:17:49 -05:00
Zeke Sikelianos
fdf3f6ce30 remove unneeded new keyword 2016-10-05 13:44:28 -07:00
Haojian Wu
0d930b65f1 📝 clang-format on Electron C++ code. 2016-10-05 22:12:48 +02:00
Zeke Sikelianos
16b3962b66 preserve custom properties passed to MenuItem constructor 2016-10-05 12:24:08 -07:00
Kevin Sawicki
4b95f3a462 Mark width/height as optional 2016-10-05 11:02:58 -07:00
Kevin Sawicki
4ffae1d563 Add spec for getAspectRatio 2016-10-05 11:02:58 -07:00
Kevin Sawicki
abffd98e29 Resize images with preserve aspect ratio 2016-10-05 11:02:58 -07:00
Kevin Sawicki
56f9cc683a bounds -> rect 2016-10-05 11:02:57 -07:00
Kevin Sawicki
49cc00dedf Add tests of resizing/cropping an empty image 2016-10-05 11:02:57 -07:00
Kevin Sawicki
9fa13710aa Document crop and resize 2016-10-05 11:02:57 -07:00
Kevin Sawicki
0eda33f057 Add tests for cropping native images 2016-10-05 11:02:57 -07:00
Kevin Sawicki
2b4fff70d5 Add initial crop method 2016-10-05 11:02:57 -07:00
Kevin Sawicki
a80f4c1605 Add specs for other create image helpers 2016-10-05 11:02:57 -07:00
Kevin Sawicki
6aba4e916a 🎨 Use deepEqual asserts 2016-10-05 11:02:57 -07:00
Kevin Sawicki
6a7f0d70fd Add native image resize tests 2016-10-05 11:02:56 -07:00
Kevin Sawicki
042684fb38 Add resize method to native image 2016-10-05 11:02:56 -07:00
Kevin Sawicki
018575de71 Merge pull request #7496 from electron/app-doc-fix
Add newline before return list
2016-10-05 09:36:01 -07:00
Kevin Sawicki
8c0588d4e0 Merge pull request #7495 from toonborgers/translate-nl
📝 Dutch translation for CONTRIBUTING.md [ci skip]
2016-10-05 09:34:08 -07:00
Kevin Sawicki
aaa8c56686 Merge pull request #7487 from fplucas/master
📝 Fix the link source-code-directory-structure.md on pt-br [ci skip]
2016-10-05 09:33:07 -07:00
Kevin Sawicki
5e936a24ac Add newline before list 2016-10-05 09:24:33 -07:00
Michael Vasseur
edd80d88a9 Update BrowserWindow's test to check additional features upon window.open() call 2016-10-05 13:45:15 +02:00
Toon Borgers
25659e482e Fix relative url 2016-10-05 12:28:36 +02:00
Toon Borgers
a097d17166 Fix relative link, added translation link for dutch 2016-10-05 12:28:08 +02:00
Toon Borgers
d4bbc24031 Translate CONTRIBUTING.md 2016-10-05 12:25:50 +02:00
Michael Vasseur
3dd41bc09a Fix errors 2016-10-05 11:46:55 +02:00
Michael Vasseur
9490ec7686 Fix JS Lint issues 2016-10-05 09:47:39 +02:00
Michael Vasseur
a2b3cf95a7 Sets correct openerId in mergeBrowserWindowOptions() to give correct options to 'new-window' event handler 2016-10-05 09:47:39 +02:00
Michael Vasseur
cc7f4fedf6 Rebase with recent changes 2016-10-05 09:47:39 +02:00
Michael Vasseur
22bd7c0271 Updated the related documentation 2016-10-05 09:47:38 +02:00
Michael Vasseur
3408c8038e Fix indentation 2016-10-05 09:47:38 +02:00
Michael Vasseur
5a4cdcfde1 'new-window' event handlers can return their window when default behavior is prevented 2016-10-05 09:46:54 +02:00
Toon Borgers
0babe4a5ed Add english version to start from 2016-10-05 09:27:20 +02:00
Toon Borgers
a538b37854 Create CONTRIBUTING.md 2016-10-05 09:16:34 +02:00
Cheng Zhao
ebaeec1677 Merge pull request #7491 from electron/initialize-direct-write-font-proxy
Enable emoji as fallback font on Windows 10
2016-10-05 14:15:55 +09:00
Kevin Sawicki
1f1d9cefca Update libchromiumcontent for #7334 2016-10-04 17:28:46 -07:00
Haojian Wu
a846088eac Add clang-format config file. 2016-10-04 22:42:49 +02:00
Kevin Sawicki
43f4eb76c4 Merge pull request #7489 from davej/patch-2
Docs: Correct image.getSize() type signature
2016-10-04 13:36:48 -07:00
Dave Jeffery
29b9fbcc9a Docs: Move buffer link to end of file 2016-10-04 21:34:24 +01:00
Dave Jeffery
4d10b9a31b Docs: Correct image.getSize() type signature 2016-10-04 21:20:42 +01:00
Lucas Pugliesi
0727102c5e 📝 Fix the link source-code-directory-structure.md on pt-br [ci skip] 2016-10-04 14:43:11 -03:00
Kevin Sawicki
4c2590ed92 Merge pull request #7486 from fplucas/master
📝 Translation of build-instructions-osx.md to pt-br [ci skip]
2016-10-04 10:31:08 -07:00
Lucas Pugliesi
66ce176b22 Merge remote-tracking branch 'upstream/master' 2016-10-04 14:27:00 -03:00
Lucas Pugliesi
a824ff479a 📝 Translation of build-instructions-osx.md to pt-br [ci skip] 2016-10-04 14:26:41 -03:00
Kevin Sawicki
c88c6b1323 Merge pull request #7481 from fplucas/master
📝 Translation of synopsis.md to pt-br [ci skip]
2016-10-04 09:11:16 -07:00
Kevin Sawicki
b459f00bd3 Merge pull request #7478 from tinydew4/translate-ko
Update the ko-KR docs related to the `additionalFeatures`.
2016-10-04 09:10:55 -07:00
Amitoj
00376c1d59 add note about windows
note "REPL is not available on Windows."
2016-10-04 19:32:46 +05:30
Lucas Pugliesi
85a8b149bb 📝 Translation of synopsis.md to pt-br [ci skip] 2016-10-04 09:37:18 -03:00
tinydew4
3fcb57559a Update the ko-KR docs related to the . 2016-10-04 08:35:07 +00:00
Cheng Zhao
bf21892cfa Merge pull request #7291 from thomsonreuters/Fix_Missing_Additional_Features_New_Popup_Windows
Fix for missing additional features fields when creating new popup windows
2016-10-04 15:42:36 +09:00
Cheng Zhao
c4576463e2 Format the docs according to style guide 2016-10-04 14:41:37 +09:00
Michael Vasseur
3af686daff Documented JavasScript API changes related to the fix for additional features processing 2016-10-04 14:38:32 +09:00
Michael Vasseur
c811188e22 Updated required code to handle missing additional features for popup windows 2016-10-04 14:38:32 +09:00
Cheng Zhao
ef88a06f08 Update libchromiumcontent for #7291 2016-10-04 14:30:59 +09:00
Cheng Zhao
cf050ff9e2 Merge pull request #7468 from electron/focus-window-when-menu-is-clicked
Focus window when menu button is pressed
2016-10-04 14:22:49 +09:00
Kevin Sawicki
bb04069e83 Merge pull request #7437 from fplucas/master
📝 Translation of CONTRIBUTING.md to pt-br [ci skip]
2016-10-03 15:37:52 -07:00
Amitoj
a938859eb8 repl-docs: move file to tutorials
also add note for renderer processes.
2016-10-04 00:12:25 +05:30
Lucas Pugliesi
8d35576a36 Merge CONTRIBUTING.md 2016-10-03 15:18:03 -03:00
Kevin Sawicki
9cae04edde Remove unused ButtonListener 2016-10-03 10:26:18 -07:00
Kevin Sawicki
11684c2c73 Focus submenu buttons when clicked 2016-10-03 10:13:41 -07:00
Kevin Sawicki
e258973490 Merge pull request #7434 from rafaelstz/patch-2
Update year in LICENSE file
2016-10-03 09:29:54 -07:00
Kevin Sawicki
00d57fa547 Merge pull request #7433 from rafaelstz/patch-1
Update license in README file
2016-10-03 09:29:26 -07:00
Kevin Sawicki
24106469c5 Merge pull request #7456 from amitmerchant1990/patch-1
Update accessibility.md
2016-10-03 09:28:22 -07:00
Kevin Sawicki
9c55280917 Merge pull request #7457 from josephfrazier/fix-findinpage-links
Fix webContents.findInPage links in docs
2016-10-03 09:22:53 -07:00
Cheng Zhao
98333049ec Merge pull request #7452 from enlight/node-buffer-safe-free
Prevent undefined behavior when some Node Buffer objects are destroyed
2016-10-03 21:57:37 +09:00
Cheng Zhao
63b45a873b Merge pull request #7451 from was4444/master
keep up with en version
2016-10-03 21:35:06 +09:00
Cheng Zhao
ec34bfde26 Merge pull request #7432 from electron/check-if-window-closed
Ignore already closed windows
2016-10-03 21:21:35 +09:00
Cheng Zhao
8ae91ea2ee Merge pull request #7444 from rogerlista/master
📝 Translation of CODE OF CONDUCT.md to pt-BR [ci skip]
2016-10-03 21:19:35 +09:00
Cheng Zhao
772c456513 Merge pull request #7335 from miniak/set-default-error-mode
Add process.setDefaultErrorMode()
2016-10-03 20:53:42 +09:00
Cheng Zhao
3a4cd19226 Merge pull request #7461 from electron/revert-7416-fix-windows-draggable-high-dpi
Revert "Fix for issues seen on frameless window (Windows) when at 200% resolution"
2016-10-03 20:42:44 +09:00
Cheng Zhao
4d8c1c61a5 Revert "Fix for issues seen on frameless window (Windows) when at 200% resolution" 2016-10-03 20:41:52 +09:00
Cheng Zhao
bee3abe334 Merge pull request #7416 from bsclifton/fix-windows-draggable-high-dpi
Fix for issues seen on frameless window (Windows) when at 200% resolution
2016-10-03 18:34:18 +09:00
Joseph Frazier
5d1c626a53 Fix webContents.findInPage links in docs 2016-10-03 02:07:52 -04:00
Amit Merchant
fb612075c4 Update accessibility.md 2016-10-03 11:13:25 +05:30
Vadim Macagon
7c5d3296e7 Prevent undefined behavior when some Node Buffer objects are destroyed
If node::Buffer::New() is used to wrap an existing chunk of memory
without providing a custom callback to release that memory then Node
will just use `free()`. In a couple of places Node buffer objects were
constructed from chunks of memory that were allocated with `new[]`, but
a custom callback to release that memory was omitted, this resulted in
undefined behavior when those buffers were destroyed because `free()`
was used to release memory allocated with `new[]`.

To avoid undefined behavior the aforementioned buffer objects are now
constructed with a custom callback that safely releases the underlying
chunk of memory.
2016-10-03 10:26:26 +07:00
Amitoj
002b9b5d4b add link to repl documentation 2016-10-02 23:47:11 +05:30
Amitoj
a0a23e04cf s/provides/provides a/ 2016-10-02 23:42:37 +05:30
wxf
763fdb4be1 keep up with en version 2016-10-02 21:45:22 +08:00
Amitoj
4d0cef5070 add REPL documentation 2016-10-02 18:20:29 +05:30
Rogério
18c7ba94f8 📝 Translation of accessibility.md to pt-BR [ci skip] 2016-10-01 21:28:17 -03:00
Rogério
5fb72b5e05 📝 Translation of README.md to pt-BR [ci_skip] 2016-10-01 20:55:12 -03:00
Rogério
960971b195 📝 Translation of CONTRIBUTING.md to pt-BR[ci skip] 2016-10-01 19:56:01 -03:00
Rogério
b10a6422d4 Translation of CODE OF CONDUCT.md to pt-BR [ci skip] 2016-10-01 17:59:30 -03:00
Lucas Pugliesi
2714f280f5 📝 Translation of file-object.md to pt-br [ci skip] 2016-10-01 09:07:49 -03:00
Lucas Pugliesi
9c53d241fa 📝 Translation of CONTRIBUTING.md to pt-br [ci skip] 2016-10-01 08:45:31 -03:00
Rafael Corrêa Gomes
f4d33e366d Update year in LICENSE file 2016-10-01 00:34:29 -03:00
Rafael Corrêa Gomes
73cdf35c98 Update license in README file 2016-10-01 00:33:51 -03:00
Kevin Sawicki
140651c258 Ignore already closed windows 2016-09-30 15:04:13 -07:00
Kevin Sawicki
ff6a8fac2a Merge pull request #7417 from electron/check-sheet-parent-before-beginning
Only begin sheet when no sheet parent
2016-09-30 13:08:35 -07:00
Kevin Sawicki
1807458c66 Only begin sheet when no sheet parent 2016-09-30 10:43:43 -07:00
Kevin Sawicki
fb41474555 Merge pull request #7429 from electron/webview-max-listeners
Ensure webviews get reset after spec finishes
2016-09-30 10:43:27 -07:00
Kevin Sawicki
3f390c6849 Ensure webviews get reset after spec finishes 2016-09-30 10:15:11 -07:00
Kevin Sawicki
4a186069d9 Merge pull request #7428 from electron/sandbox-specs
Explicitly close popup window from sandbox spec
2016-09-30 09:28:59 -07:00
Kevin Sawicki
d942694695 openedWindow -> popupWindow 2016-09-30 08:54:24 -07:00
Kevin Sawicki
766f5afabd Explicitly close popup window 2016-09-30 08:50:41 -07:00
Kevin Sawicki
e16fa08e61 🎨 2016-09-30 08:38:21 -07:00
Kevin Sawicki
b07d4eba11 Merge pull request #7427 from tinydew4/translate-ko
Update ko-KR/api/session.md
2016-09-30 08:14:46 -07:00
tinydew4
f1d1070baa Update ko-KR/api/session.md 2016-09-30 15:09:11 +00:00
Kevin Sawicki
0c146de7dd Merge pull request #7422 from tinydew4/translate-ko
Update korean CODE_OF_CONDUCT.md
2016-09-30 07:56:07 -07:00
Cheng Zhao
5a56de501a Bump v1.4.2 2016-09-30 17:39:27 +08:00
Cheng Zhao
11d16a7342 Merge pull request #7415 from electron/disable-tab-menu-on-sierra
Hide Show Tab Bar menu item on macOS Sierra
2016-09-30 17:23:54 +08:00
Cheng Zhao
1b5db42ec6 Merge pull request #7398 from electron/cookie-changed-event
Add cookie changed event
2016-09-30 17:10:44 +08:00
tinydew4
0b6b4ca50d Update CODE_OF_CONDUCT.md 2016-09-30 06:32:07 +00:00
tinydew4
e7e8b3fdb6 Remove BOM to korean docs 2016-09-30 00:03:29 +00:00
Milan Burda
5bfa898a02 Always drop SEM_NOGPFAULTERRORBOX flag from error mode (enables WER if crashReporter is not started) 2016-09-29 13:57:41 -07:00
Kevin Sawicki
770a3509cf Add forward declaration of NSWindow.allowsAutomaticWindowTabbing 2016-09-29 10:54:59 -07:00
Kevin Sawicki
b14870d9a1 Merge pull request #7413 from deepak1556/devtools_filesystemapi_patch
browser: allow filesystem access for devtools scheme
2016-09-29 10:52:47 -07:00
Brian Clifton
52340b43f5 Possible fix for issues seen on frameless window (Windows) when at 200% 2016-09-29 10:48:36 -07:00
deepak1556
1323542373 browser: allow filesystem access for devtools scheme 2016-09-29 22:54:39 +05:30
Kevin Sawicki
24b9313958 Disable Show Tab Bar menu item on macOS Sierrra 2016-09-29 10:18:15 -07:00
Kevin Sawicki
0e1290fc10 Upgrade brightray for merged cookie delegate support 2016-09-29 09:18:21 -07:00
Kevin Sawicki
8abe8fe01d Remove unneeded locker and handle scope 2016-09-29 09:16:35 -07:00
Kevin Sawicki
77b35ba7ab Use separate session for cookies change event test 2016-09-29 09:16:35 -07:00
Kevin Sawicki
96e48ac13c Document cookie changed event 2016-09-29 09:16:35 -07:00
Kevin Sawicki
d83534d513 Add specs for cookie changed event 2016-09-29 09:16:35 -07:00
Kevin Sawicki
19c7ee0932 Use scoped_refptr for cookie delegate 2016-09-29 09:16:35 -07:00
Kevin Sawicki
24bcf6ac16 Add initial cookie changed event support 2016-09-29 09:16:29 -07:00
Kevin Sawicki
5d23d165a9 Upgrade brigthray for cookie monster delegate 2016-09-29 09:16:29 -07:00
Kevin Sawicki
b3b9994ce8 Configure ink drops on menu bar buttons (#7397)
* Add ink drop to menu bar buttons

* Pass background color to submenu button

* Sort includes
2016-09-29 09:15:12 -07:00
Arus
df0bda058f Update korean docs, according to most recent changes and other missing. (#7400)
* Apply changes

* Apply changes

* Apply changes

* Apply changes

* Fix all JS standard syntax errors

* Apply of recent changes, #7374
2016-09-29 08:52:40 -07:00
Cheng Zhao
15b8449411 Merge pull request #7393 from electron/upgrade-brigthray-for-ct-fix
Upgrade Brightray for certificate transparency crash fix
2016-09-29 16:56:31 +08:00
Cheng Zhao
e1d68fa3cd Merge pull request #7374 from electron/fixup-return-values
Update docs to contain more specific return values
2016-09-29 16:44:08 +08:00
Cheng Zhao
2c9ce3f3e0 Merge pull request #7372 from electron/update-docs-linter
update electron-docs-linter
2016-09-29 16:43:22 +08:00
Cheng Zhao
734f42b5f9 Merge pull request #7319 from Menci/master
Workaround for electron/electron#5050
2016-09-29 16:42:30 +08:00
Kevin Sawicki
3cff64001d Upgrade brightray for CT crash fix 2016-09-28 16:02:48 -07:00
Kevin Sawicki
241297fb2e Merge pull request #7388 from electron/custom-window-level-test
Add test for BrowserWindow.setAlwaysOnTop
2016-09-28 15:47:29 -07:00
Kevin Sawicki
d4583006b3 Merge pull request #7391 from kiavashps/patch-1
docs: app.md - fix relaunch arg concat syntax
2016-09-28 10:30:59 -07:00
Kiavash Page
d42e51e33a app.md - fix relaunch arg concat syntax 2016-09-28 10:23:03 -07:00
Kevin Sawicki
3bed19d70d Add spec for BrowserWindow.setAlwaysOnTop 2016-09-28 09:23:52 -07:00
Kevin Sawicki
fd6ef6712f Link to window level macOS docs 2016-09-28 09:20:22 -07:00
Cheng Zhao
c51982a231 Merge pull request #7362 from bsclifton/fix-windows-draggable-high-dpi
Fixes mouse coordinates for Windows when display is set to a higher DPI
2016-09-28 19:42:17 +08:00
Cheng Zhao
53d4c36332 Merge pull request #7353 from electron/no-login-item-apis-on-mas
document lack of MAS support for login item APIs
2016-09-28 19:20:32 +08:00
Cheng Zhao
de76bf5f63 Merge pull request #7296 from adammeyer/custom-window-level
Allow custom window level when sending window to top
2016-09-28 19:18:12 +08:00
Samuel Attard
e0e47ea9a1 Update docs to contain more specific return values 2016-09-28 18:28:44 +13:00
Zeke Sikelianos
3989139378 update electron-docs-linter 2016-09-27 22:04:22 -07:00
Menci
ca68dfe097 🎨 Remove extra semicolon 2016-09-28 06:45:15 +08:00
Kevin Sawicki
5114d571df Merge pull request #7364 from tiagotol/patch-1
Update quick-start.md
2016-09-27 13:02:25 -07:00
tiagotol
08808664b6 Update quick-start.md 2016-09-27 14:29:35 -03:00
Brian Clifton
13de65d310 Fixes mouse coordinates for Windows when display is set to a higher DPI (ex: enlarged by 150% using display settings) 2016-09-27 08:23:48 -07:00
Zeke Sikelianos
6728efe87e Merge pull request #7339 from electron/document-return-values
Document the return values of all methods in the docs
2016-09-27 07:39:25 -07:00
Cheng Zhao
458c4dd129 Merge branch 'support-chromium-sandbox' of https://github.com/tarruda/electron into tarruda-support-chromium-sandbox 2016-09-27 20:02:23 +08:00
Menci
ef45b67dbf 🐧 🐛 Move the workaround to lib/browser/init.js 2016-09-27 19:19:52 +08:00
Cheng Zhao
604700187d Merge pull request #7327 from MaxWhere/osr-fixes
Small fixes for offscreen rendering
2016-09-27 19:17:10 +08:00
Cheng Zhao
7e1ae369ed Merge pull request #7356 from electron/fix-typo
fix typo
2016-09-27 19:05:06 +08:00
Cheng Zhao
9850af93c9 Merge pull request #7313 from electron/add-type-to-webview-style-tag
add type to webview style tag
2016-09-27 19:03:08 +08:00
Cheng Zhao
4c8d0ab804 Merge pull request #7298 from deepak1556/content_settings_patch
protocol: disable storage for non standard custom schemes
2016-09-27 18:52:36 +08:00
Thiago de Arruda
47fd41715f Add some tests for "sandbox" option 2016-09-27 06:01:47 -03:00
Thiago de Arruda
a64978b812 Use the routing id on api::WebContents::GetID
The sandbox option allows multiple webContents in one renderer process, so using
the only the renderer id to identify WebContents instances is no longer an
option.

WebContents::GetID now returns a 64-bit integer, which is composed of both the
process id(high 32), and the RenderViewHost routing id(low 32). Also add a
`GetProcessID` that retrieves the renderer process id, a requirement in some of
our javascript code.
2016-09-27 06:01:47 -03:00
Thiago de Arruda
524bab530a Improve AtomSandboxedRendererClient to support preload scripts.
Add RenderFrameObserver/RenderViewObserver subclasses that implement the
necessary support for preload scripts in sandboxed renderers.
2016-09-27 06:01:47 -03:00
Thiago de Arruda
72154b64ed Embed setup bundle for preload scripts in sandboxed renderers.
Add a gyp target that creates a browserify bundle starting with
`lib/sandboxed_renderer/init.js`, which is embedded into the executable using
the `atom_js2c` target.

The goal of this bundle is to provide a very basic environment for preload
scripts where a `require` function is available.
2016-09-27 06:01:47 -03:00
Thiago de Arruda
695509e267 Add browser side support for reading files from renderer. 2016-09-27 06:01:46 -03:00
Thiago de Arruda
0f7652dc85 Move code that defines ipcRenderer methods into another file. 2016-09-27 06:01:46 -03:00
Thiago de Arruda
1713200084 Refactor the atom_js2c target to include javascript from multiple dirs.
Before invoking js2c, copy all files that must be embedded into the shared
intermediate directory, and modify the js2c wrapper script to include all files
from that directory(which is passed as argument).

This allows the build system to embed files that don't share a common base
directory, such as javascript generated at build time.
2016-09-27 06:01:46 -03:00
Thiago de Arruda
6afe8aa7f2 Move EmitIPCEvent into AtomRenderViewObserver.
Refactor this function as a method so it is possible to inherit most behavior
from AtomRenderViewObserver and override EmitIPCEvent.
2016-09-27 06:01:46 -03:00
Thiago de Arruda
c8629019f5 Expose atom_api_renderer_ipc module API 2016-09-27 06:01:46 -03:00
Thiago de Arruda
a7b6332ed0 Add atom::AtomSandboxedRendererClient class 2016-09-27 06:01:46 -03:00
Thiago de Arruda
06cc9a44fe Add support for native chromium popups on sandboxed renderers.
- Allow `api::Window` instances to be created from existing `api::WebContents`.
- Override `WebContentsCreated` and `AddNewContents` to wrap renderer-created
  `content::WebContents` into `api::WebContents`.
- For `content::WebContents` that should be displayed in new windows, pass the
  wrapped `api::WebContents` object to window manager.
2016-09-27 06:01:46 -03:00
Thiago de Arruda
0b3b29938f Allow api::WebContents to fully wrap an existing content::WebContents.
- Add an overload to `WebContents::CreateFrom` that accepts a type parameter. If
  type is `REMOTE`, initialization is the same as before(a thin wrapper). If
  not, the `api::WebContents` will be fully initialized, as if it was created by
  `api::WebContents::Create`.
- Move common initialization code to `InitWithSessionAndOptions`.
2016-09-27 06:01:46 -03:00
Thiago de Arruda
1b1541fe1a Decouple api::Window initialization from api::WebContents construction. 2016-09-27 06:01:46 -03:00
Thiago de Arruda
1d228446db Expose --enable-sandbox command-line switch.
When `--enable-sandbox` is passed, electron will use chromium sandbox to spawn
all renderers, and every new BrowserWindow will automatically have "sandboxed"
passed as a web preference(since the renderer would not work properly
otherwise).
2016-09-27 06:01:46 -03:00
Thiago de Arruda
c783ec72bc Add "sandboxed" option to "webPreferences".
When "sandboxed" is passed as a web preference for `BrowserWindow`, the newly
created renderer won't run any node.js code/integration, only communicating with
the system via the IPC API of the content module. This is a requirement for
running the renderer under chrome OS-level sandbox.

Beyond that, certain behaviors of AtomBrowserClient are modified when dealing
with sandboxed renderers:

- `OverrideSiteInstanceNavigation` no longer create a new `SiteInstance` for
  every navigation. Instead, it reuses the source `SiteInstance` when not
  navigating to a different site.
- `CanCreateWindow` will return true and allow javascript access.
2016-09-27 06:01:46 -03:00
Zeke Sikelianos
90c5972fce Merge pull request #7342 from tinydew4/update-changes
Update changes to korean docs.
2016-09-26 22:19:45 -07:00
Zeke Sikelianos
1f677ed361 fix typo 2016-09-26 22:12:51 -07:00
Zeke Sikelianos
9c19b4e3d5 Merge pull request #7343 from tinydew4/translate-ko
Translate newest styleguide.md and update changes to system-preferences.md
2016-09-26 21:47:42 -07:00
Zeke Sikelianos
d4a1f396fb tweak wording about complex objects 2016-09-26 21:04:54 -07:00
arus
72e3816143 Change a word 2016-09-27 09:38:23 +09:00
arus
9dd181c206 Change some sentences after review 2016-09-27 09:34:59 +09:00
Zeke Sikelianos
9828926002 Merge pull request #7340 from tinydew4/fix-link
Fix broken link in original docs
2016-09-26 12:04:22 -07:00
Zeke Sikelianos
bb955b6202 document lack of MAS support for login item APIs 2016-09-26 11:00:13 -07:00
Cheng Zhao
1dd05ff520 Merge pull request #7338 from electron/fix-get-accent-color-docs
Fix getAccentColor() docs in system-preferences.md
2016-09-26 15:39:40 +08:00
Cheng Zhao
19bd5ea8ba Merge pull request #7316 from tinydew4/update-ko
Update debugging-main-process and Add planned-breaking-changes
2016-09-26 12:56:22 +08:00
arus
bcf7a86dc7 Update changes to ko-KR/api 2016-09-26 00:03:32 +09:00
arus
2fbdac1034 Update changes to ko-KR/api/app.md 2016-09-25 23:50:36 +09:00
arus
577585df63 Update changes to ko-KR/api/power-monitor.md 2016-09-25 23:48:09 +09:00
arus
f13bd655a1 Update changes to ko-KR/api/screen.md 2016-09-25 23:45:56 +09:00
arus
81de0518d9 Update changes to ko-KR/api/web-contents.md 2016-09-25 23:43:24 +09:00
arus
d93a86e8cc Remove some changes 2016-09-25 23:37:34 +09:00
arus
7e186cee55 Remove some changes 2016-09-25 23:28:59 +09:00
arus
97da066ae2 Update changes to ko-KR/api/web-contents.md 2016-09-25 23:25:05 +09:00
arus
b58f73b5c9 Update change to ko-KR/README.md 2016-09-25 23:18:18 +09:00
arus
ad1cb16a76 Update changes to web-view-tag.md 2016-09-25 22:58:41 +09:00
arus
cd4a66dca5 Update changes to browser-window.md 2016-09-25 22:40:05 +09:00
arus
cc282a1114 Update /ko-KR/api/system-preferences.md 2016-09-25 21:57:43 +09:00
arus
270d6f774a Update changes to browser-window and correct a word 2016-09-25 21:40:33 +09:00
Samuel Attard
987a2e173a Fix docs linting 2016-09-25 21:57:37 +13:00
arus
66efaa5e0f Update /ko-KR/styleguide.md 2016-09-25 17:04:34 +09:00
arus
27a9f960de Fix broken link 2016-09-25 16:15:16 +09:00
arus
74e03d285e Fix broken link 2016-09-25 16:13:34 +09:00
arus
123f2a8265 Update /ko-KR/styleguide.md 2016-09-25 16:05:45 +09:00
arus
d25c2d0f41 Update /ko-KR/api/system-preferences.md 2016-09-25 16:05:45 +09:00
Samuel Attard
d2a701a465 Document the return values of all methods in the docs 2016-09-25 12:59:30 +13:00
Vadim Macagon
1df30821db Fix getAccentColor() docs in system-preferences.md
Example was using a non-existent method.
2016-09-25 01:45:34 +07:00
Zeke Sikelianos
bf88fe32fd Merge pull request #7333 from tinydew4/translate-ko
Translate CODE_OF_CONDUCT and change a word as other docs, in korean
2016-09-24 10:04:04 -07:00
arus
e21d5bd380 Change some sentences more smoothly 2016-09-24 15:58:58 +09:00
arus
04bdc87283 Change some smoothly 2016-09-24 11:33:31 +09:00
arus
177ccbc014 Translate CODE_OF_CONDUCT and change a word as other docs, in korean 2016-09-24 10:37:17 +09:00
Zeke Sikelianos
d6cd9e3034 Merge pull request #7331 from tinydew4/fix-link
Fix broken links
2016-09-23 17:19:07 -07:00
Zeke Sikelianos
d391f1b527 Merge pull request #7330 from tinydew4/translate-ko
Translate accessibility and change some in korean
2016-09-23 17:07:40 -07:00
arus
8c7a4de27b Fix broken links 2016-09-24 08:26:25 +09:00
Arus
7cd7894878 Update accessibility.md 2016-09-24 08:23:36 +09:00
arus
d7fc7ef2ee Fix errata 2016-09-24 08:19:24 +09:00
arus
6aef061362 Translate accessibility.md in korean 2016-09-24 08:14:19 +09:00
arus
e4943b3ab3 Change more smoothly 2016-09-24 07:18:39 +09:00
arus
091136908d Replace changes as link of original docs 2016-09-24 06:51:28 +09:00
Zeke Sikelianos
c6390e71d9 Merge pull request #7314 from tinydew4/translate-ko
Translate ko, debug-instructions-macos.md
2016-09-23 11:53:45 -07:00
gellert
ab5e51c209 fixes software rendering on macos and small resizing addition 2016-09-23 20:27:05 +02:00
Menci
938b9e897a 🐧 🐛 Workaround for electron/electron#5050
Chromium only show the Tray icon with libappindicator when the env `XDG_CURRENT_DESKTOP`'s value is `Unity`. But under elementaryOS its value is 'Pantheon'.

Set it to `Unity` before app startup make the tray icon show under elementaryOS.
2016-09-23 18:07:43 +08:00
arus
924033c2ba Remove notice on top 2016-09-23 14:03:42 +09:00
arus
99e256f461 Translate debug-instructinos-macos.md in korean 2016-09-23 14:03:42 +09:00
arus
d2bcbafe73 Translate additonally 2016-09-23 12:56:21 +09:00
arus
5c07643d24 Apply debugging-main-process changes in korean 2016-09-23 12:51:28 +09:00
Zeke Sikelianos
56d62ff589 add html doctype 2016-09-22 14:47:20 -07:00
Zeke Sikelianos
62375663ab add type to webview style tag 2016-09-22 14:34:03 -07:00
Kevin Sawicki
f5694daeb7 Merge pull request #7299 from Gioggio/master
Docs: Start Italian translations
2016-09-22 12:21:09 -07:00
Gioggio
3a73625ece 📝 Update translation for faq.md
[ci skip]
2016-09-22 21:07:13 +02:00
Gioggio
3b45f5a8e9 📝 Add styleguide.md
[ci skip]
2016-09-22 21:07:13 +02:00
Gioggio
78791763cf 📝 Fix typos and improve translations in README.md
[ci skip]
2016-09-22 21:07:13 +02:00
Gioggio
81b55c1700 📝 Add faq.md
[ci skip]
2016-09-22 21:07:13 +02:00
Gioggio
39a3ffdb9d 📝 Add README.md
[ci skip]
2016-09-22 21:07:13 +02:00
Kevin Sawicki
df03c92249 Compare against NSNormalWindowLevel in IsAlwaysOnTop 2016-09-22 09:41:06 -07:00
Kevin Sawicki
c336cf59c1 Ignore level when calling SetAlwaysOnTop on Widget 2016-09-22 09:38:04 -07:00
Kevin Sawicki
fcd6fd9fd5 Merge pull request #7310 from BenV/patch-1
Add npm_config_target_arch to native module doc
2016-09-22 09:34:19 -07:00
Kevin Sawicki
1ec173ad81 Merge pull request #7308 from tinydew4/translate-ko
Apply docs changes to korean docs
2016-09-22 09:32:41 -07:00
Kevin Sawicki
bce62622bb Fix compiler errors 2016-09-22 09:22:28 -07:00
Ben Vinson
1290ddb5c9 Add npm_config_target_arch to native module doc
We ran into an issue when creating a 32-bit binary on 64-bit Windows where node-pre-gyp kept using the 64-bit library. Setting the `npm_config_target_arch` environment variable resolved the problem for us and caused the 32-bit binary to be built and used.
2016-09-22 09:46:31 -06:00
Kevin Sawicki
ea42722918 Merge pull request #7284 from enlight/debugging-with-electron-inspector
Split up debugging-main-process.md, add electron-inspector guide
2016-09-22 08:40:38 -07:00
arus
aac09e5234 Fix erratum 2016-09-22 22:56:19 +09:00
arus
df3896b143 Apply docs changes to korean docs 2016-09-22 22:53:11 +09:00
Cheng Zhao
903bf444d9 Bump v1.4.1 2016-09-22 19:05:58 +09:00
Cheng Zhao
3dad8734a0 Do not copy api.json on Windows 2016-09-22 19:05:58 +09:00
Vadim Macagon
762a5bbefa Split up debugging-main-process.md, add electron-inspector guide
- Move the debugging guides for VSCode and node-inspector into separate
  files.
- Add instructions for using electron-inspector to the node-inspector
  guide.
- Remove note in node-inspector guide about crashing when inspecting
  `process` (it was fixed a long time ago:
  https://github.com/nodejs/node-v0.x-archive/issues/8205)
2016-09-22 15:43:06 +07:00
Cheng Zhao
d3a175cea8 Merge pull request #7303 from electron/fix-out-dir
electron-api.json is under out/ instead of out/R/
2016-09-22 14:39:33 +09:00
Cheng Zhao
4e0f810148 electron-api.json is under out/ instead of out/R/ 2016-09-22 14:31:28 +09:00
Cheng Zhao
32543997d4 Merge pull request #7297 from electron/clean-docs
Mention build cleaning on all three platforms
2016-09-22 14:14:36 +09:00
Cheng Zhao
c9a3ab3a81 Merge pull request #7295 from electron/native-image-bad-path-docs
Mention createFromPath bad path return value
2016-09-22 14:14:15 +09:00
Cheng Zhao
3b4a071723 Merge pull request #7294 from electron/mutate-remote-array-docs
Mention mutating remote arrays and buffers
2016-09-22 14:13:49 +09:00
Cheng Zhao
de9b01409b Merge pull request #7293 from electron/bookmark-windows-docs
Mention using fallback text when writing bookmarks on Windows
2016-09-22 14:13:28 +09:00
Cheng Zhao
296a53536d Merge pull request #7292 from electron/ct-log-verifiers
Upgrade Brigthray for CT log verifier fix
2016-09-22 14:11:20 +09:00
adammeyer
783d47f78b custom window level as string 2016-09-21 22:49:06 -04:00
adammeyer
b35bde662a custom window level docs 2016-09-21 19:06:36 -04:00
deepak1556
ad783652c8 update docs 2016-09-22 00:20:34 +05:30
deepak1556
7ba947aee9 add spec 2016-09-22 00:15:25 +05:30
Kevin Sawicki
696e5e73bc Upgrade Brigthray for CT log verifier fix 2016-09-21 11:29:09 -07:00
Kevin Sawicki
a723d17f49 Mention cleaning on all three platforms 2016-09-21 11:10:52 -07:00
Kevin Sawicki
f8236c1a65 Add more failure asserts for nativeImage.createFromPath 2016-09-21 10:48:24 -07:00
Kevin Sawicki
546c0e7822 Mention createFromPath failure cases 2016-09-21 10:48:01 -07:00
Kevin Sawicki
e7c4d2523b Mention mutating remote arrays and buffers 2016-09-21 10:44:54 -07:00
adammeyer
fbb3a288ec Allow custom window level when sending window to top 2016-09-21 13:35:59 -04:00
Kevin Sawicki
cae15ad6b5 Mention using fallback text when writing bookmarks on Windows 2016-09-21 10:31:01 -07:00
deepak1556
ed465208a2 renderer: add content settings class for managing storage 2016-09-21 21:47:30 +05:30
Kevin Sawicki
c2c48c4079 Merge pull request #7290 from tinydew4/translate-ko
Translate tutorial/about.md
2016-09-21 09:04:20 -07:00
Kevin Sawicki
dc7d2dab68 Merge pull request #7287 from tinydew4/translate-update
Update windows-store-guide.md in ko-KR docs
2016-09-21 09:03:48 -07:00
arus
146970d29d Add missing sample codes 2016-09-22 00:35:27 +09:00
arus
ba2cb42f0d Remove incorrect letters 2016-09-22 00:30:20 +09:00
arus
7dfe1a59b1 Translate remains in about.md 2016-09-22 00:18:28 +09:00
arus
4343f762ac Translate some in about.md 2016-09-22 00:15:57 +09:00
arus
e2f53c6bcc Translate some in about.md 2016-09-22 00:13:44 +09:00
arus
5c22f2ca5d Translate some in about.md 2016-09-22 00:05:26 +09:00
arus
b6d4014bd5 Translate some in about.md 2016-09-22 00:04:24 +09:00
arus
6b8f5f5b7f Translate some in about.md 2016-09-22 00:01:21 +09:00
arus
b7e2f819a3 Translate Core Philosophy in about.md 2016-09-21 23:55:16 +09:00
arus
a8e0e8d7fd Translate LTS in about.md 2016-09-21 23:42:07 +09:00
arus
beea9a7c36 Translate Update dependencies and Versioning in about.md 2016-09-21 23:35:19 +09:00
arus
a44d7a3bc6 Translate some in aboud.md 2016-09-21 23:11:29 +09:00
arus
b45db70d21 Translate Releases in about.md 2016-09-21 23:08:32 +09:00
arus
8feff471ce Modify some in about.md 2016-09-21 23:04:41 +09:00
arus
00dec166e9 Translate Core Team and Contributors in about.md 2016-09-21 23:03:23 +09:00
arus
ebbbaf1ab0 Translate Core Team and Contributors in about.md 2016-09-21 23:03:02 +09:00
arus
29312186de Translate about/about electron in Korean 2016-09-21 22:38:17 +09:00
arus
e1d9e4ffcb Merge branch 'translate-update' of https://github.com/tinydew4/electron into translate-update 2016-09-21 22:01:54 +09:00
arus
b6c04c9e35 Update windows-store-guide.md in ko-KR docs 2016-09-21 22:00:48 +09:00
arus
405b411a29 Merge branch 'translate-update' of https://github.com/tinydew4/electron into translate-update 2016-09-21 21:44:07 +09:00
arus
582fc50cf6 Update windows-store-guide.md in ko-KR docs 2016-09-21 21:43:18 +09:00
arus
b74cfda7b9 Update windows-store-guide.md in ko-KR docs 2016-09-21 21:35:35 +09:00
Cheng Zhao
805ce0dee9 Merge pull request #7276 from electron/google-api-key-env2
allow GOOGLE_API_KEY to be set
2016-09-21 15:16:29 +09:00
Zeke Sikelianos
f4a8fb9eb4 🎨 standard 2016-09-20 14:55:45 -07:00
Kevin Sawicki
85702604c3 Merge pull request #7277 from electron/dictionary-to-object
Set parameter type to Object instead of Dictionary
2016-09-20 14:48:48 -07:00
Kevin Sawicki
98999f4850 Add missing s in progress 2016-09-20 14:46:17 -07:00
Kevin Sawicki
b5e1571204 Set parameter type to Object 2016-09-20 14:26:55 -07:00
Zeke Sikelianos
d7934e7525 add link to chromium API keys doc 2016-09-20 14:13:30 -07:00
Zeke Sikelianos
7fcba6ba0f document the GOOGLE_API_KEY env var 2016-09-20 13:58:39 -07:00
Kevin Sawicki
ea1927f428 Store api_key_ on TokenLoadingJob 2016-09-20 13:24:45 -07:00
Zeke Sikelianos
fa2aaa48b1 allow GOOGLE_API_KEY to be set in environment 2016-09-20 12:01:59 -07:00
Kevin Sawicki
dee383db07 Merge pull request #7273 from tinydew4/fix-links
Fix some bronken links
2016-09-20 09:00:08 -07:00
Kevin Sawicki
04a1dc8e1e Merge pull request #7272 from tinydew4/translate-ko
Translate "offscreen rendering" in Korean
2016-09-20 08:59:53 -07:00
Kevin Sawicki
ae31ded165 Merge pull request #7265 from octref/patch-1
Add instruction for debugging main process in VSCode
2016-09-20 08:59:37 -07:00
arus
402e977b40 Fix some bronken links 2016-09-20 23:36:20 +09:00
arus
a65c8cae63 modify some 2016-09-20 23:30:46 +09:00
arus
47a03d3ca1 modify some 2016-09-20 23:29:34 +09:00
arus
b4a13fda3a Translate offscreen rendering in Korean 2016-09-20 23:19:15 +09:00
Cheng Zhao
e11672d42b Merge pull request #7262 from tinydew4/patch-1
Update browser-window.md
2016-09-20 16:04:25 +09:00
Cheng Zhao
30a6b597a5 Merge pull request #7239 from darkdh/6873
Emit scroll-touch-edge event instead of changing the behavior of scrollll-touch-begin/end
2016-09-20 14:51:10 +09:00
Pine
c45ca254e3 Add instruction for debugging main process in VSCode
I hope you don't mind me putting the VSCode part before `node-inspector`, because VSCode seems easier to setup, and VSCode could inspect `process` without crashing.
2016-09-19 22:43:05 -07:00
Cheng Zhao
143d7ab98f Merge pull request #7264 from electron/docs-readme
Docs Readme
2016-09-20 14:31:31 +09:00
Cheng Zhao
e3e450613d Merge pull request #7157 from Mossop/moveguest
Allow moving a webcontents to a different webview
2016-09-20 14:28:42 +09:00
Cheng Zhao
77fdc67235 Merge pull request #7173 from electron/windows-system-color
Add an app API method to fetch the system ColorizationColor
2016-09-20 14:06:21 +09:00
Zeke Sikelianos
61e50046bd link to the documentation styleguide 2016-09-19 21:10:36 -07:00
Zeke Sikelianos
1cdf8bbc10 break up run-on sentence 2016-09-19 21:09:31 -07:00
Zeke Sikelianos
a3d2cdaa2c website doesn't display docs for old versions any more 2016-09-19 21:09:02 -07:00
Arus
159e2f2dab Update browser-window.md 2016-09-20 11:26:04 +09:00
Kevin Sawicki
e8f3cf164b Merge pull request #7227 from electron/felix-cmd-strings
Ensure correct types for commandLine
2016-09-19 10:22:28 -07:00
Samuel Attard
456f102cdc Fix k typo 2016-09-20 02:42:41 +10:00
Samuel Attard
ba98109d33 Remove semicolons from spec 2016-09-20 02:41:26 +10:00
Samuel Attard
9f94652792 Add basic spec for getAccentColor 2016-09-20 02:41:26 +10:00
Samuel Attard
1454510549 Alphabetical method ordering 2016-09-20 02:41:26 +10:00
Samuel Attard
c0f8b4895d Update docs 2016-09-20 02:41:26 +10:00
Samuel Attard
5dd5dbb3d8 Add a systemPreferences API method to fetch the system ColorizationColor
This is useful for automatical app theming

* Fetches the color from the registry
* Returns an empty string if the fetch fails (a falsey value)
2016-09-20 02:41:26 +10:00
Kevin Sawicki
48fd2bd35f binding -> bindings 2016-09-19 09:31:59 -07:00
Felix Rieseberg
29fa48d8c3 🔧 Ensure correct types for commandLine
This commit ensures that arguments passed to `appendSwitch` and `appendArgument` are turned into strings before passing them over to the binding.
2016-09-19 09:31:59 -07:00
Felix Rieseberg
90bff4d9de 🔧 Ensure correct types for commandLine
This commit ensures that arguments passed to `appendSwitch` and `appendArgument` are turned into strings before passing them over to the binding.
2016-09-19 09:31:59 -07:00
Cheng Zhao
b05254807b Merge pull request #7253 from electron/osr-crash
Unsubscribe observer when OffScreenRenderWidgetHostView is destroyed
2016-09-19 17:54:31 +09:00
Cheng Zhao
e504d82554 spec: Suppress the download.pdf test on AppVeyor 2016-09-19 17:12:33 +09:00
Cheng Zhao
5bf746700e Unsubscribe observer when OffScreenRenderWidgetHostView is destroyed 2016-09-19 16:51:03 +09:00
Cheng Zhao
07a08077a2 Revert electron/brightray#246 2016-09-19 16:31:00 +09:00
Cheng Zhao
26004f1a66 Merge pull request #7241 from miniak/crashed-killed
Add killed argument for webContents.on("crashed") and app.on("gpu-process-crashed") events
2016-09-19 16:02:52 +09:00
Cheng Zhao
1c6586c4b9 Merge pull request #7238 from electron/felix-windows-store-docs
Update Windows Store Language
2016-09-19 15:54:23 +09:00
Cheng Zhao
0ac4b89a0a Merge pull request #7236 from yuya-oc/accelerator-for-redo
Use Ctrl+Y as the accelerator of redo on Windows
2016-09-19 15:53:44 +09:00
Cheng Zhao
6de1eef078 Merge pull request #7234 from Mossop/testhistoryreplace
 Test that replacement history entries don't break forward navigation.
2016-09-19 15:47:30 +09:00
Cheng Zhao
1fd819e500 Merge pull request #7231 from miniak/default-error-mode
Fix ELECTRON_DEFAULT_ERROR_MODE
2016-09-19 15:44:52 +09:00
Cheng Zhao
a260647b4f Merge pull request #7062 from MaxWhere/osr-sizing-fix
Offscreen invalidate and sizing fix
2016-09-19 15:38:11 +09:00
Cheng Zhao
ffe931bde7 Merge pull request #7226 from electron/power-monitor-error
Rethrow caught errors from process.binding
2016-09-19 15:25:18 +09:00
Cheng Zhao
27bc6c7883 Merge pull request #7233 from electron/deprecate-atom-shell-version
Deprecate process.versions['atom-shell']
2016-09-19 15:24:10 +09:00
Cheng Zhao
6c340cece8 Merge pull request #7229 from electron/update-clang
Update clang to r274142.
2016-09-19 15:23:57 +09:00
Cheng Zhao
64718173ef Merge pull request #7230 from electron/windows-x64-link-crypt32
Link against crypt32.lib
2016-09-19 15:23:41 +09:00
Yuya Ochiai
43f955194e 🏁 Use Ctrl+Y as the accelerator of redo on Windows 2016-09-18 17:07:34 +09:00
Milan Burda
8567f79e67 Add killed argument for webContents.on("crashed") and app.on("gpu-process-crashed") events 2016-09-17 17:02:36 -07:00
Anthony Tseng
269a87b26f Emit scroll-touch-edge event instead of changing the behavior of scroll-touch-begin/end
fix #6873
2016-09-17 22:50:10 +08:00
Felix Rieseberg
084110c56f 📝 Update Windows Store Language 2016-09-17 04:19:55 -07:00
Dave Townsend
47df447e4f Test that replacement history entries don't break forward navigation.
This is a test for #7175
2016-09-16 17:08:54 -07:00
Kevin Sawicki
1072519488 Mark atom-shell version as deprecated 2016-09-16 15:59:00 -07:00
gellert
37de2301f7 moves setsize call to osr renderwidgethostview 2016-09-16 23:28:51 +02:00
gellert
fec5a7d67a removes extra header 2016-09-16 23:27:51 +02:00
gellert
8baaad4e0d cleanup and adds docs 2016-09-16 23:27:51 +02:00
gellert
10ea0268e5 calling setsize only on osr windows 2016-09-16 23:27:11 +02:00
gellert
b4c220613f adds invalidate method and proper resizing 2016-09-16 23:27:11 +02:00
Zeke Sikelianos
d4b204799d Merge pull request #7120 from electron/lint-docs
Publish the public API as a JSON object
2016-09-16 14:05:32 -07:00
Milan Burda
12a2b144f3 Only drop the SEM_NOGPFAULTERRORBOX flag when calling SetErrorMode (ELECTRON_DEFAULT_ERROR_MODE) 2016-09-16 14:01:33 -07:00
Kevin Sawicki
7df86c48fa Link against crypt32.lib 2016-09-16 13:17:58 -07:00
Kevin Sawicki
0c3ad527e3 initialize -> require 2016-09-16 13:09:06 -07:00
Haojian Wu
37e30cef60 Update clang to r274142. 2016-09-16 21:59:25 +02:00
Kevin Sawicki
0fda86f79a Mention not requiring module until app is ready 2016-09-16 11:42:02 -07:00
Kevin Sawicki
e77d7e7f62 🎨 2016-09-16 11:41:53 -07:00
Kevin Sawicki
5d0f3534eb Rethrow binding errors 2016-09-16 11:34:52 -07:00
Kevin Sawicki
577394442b power-monitor -> powerMonitor 2016-09-16 09:58:27 -07:00
Cheng Zhao
d1274bb79f Update brightray for #7073 2016-09-16 21:28:24 +09:00
Cheng Zhao
da677b683b Merge pull request #7163 from MaxWhere/frame-sub-scale-fix
Frame subscriber improvements
2016-09-16 21:24:53 +09:00
Cheng Zhao
9dad9478fa Merge pull request #7169 from deepak1556/download_defaultname_patch
browser: provide a default filename when unable to generate from download data
2016-09-16 21:19:21 +09:00
Cheng Zhao
ea244a5188 Merge pull request #7209 from electron/remote-function-missing-properties
Guard against missing remote function properties
2016-09-16 21:11:12 +09:00
Cheng Zhao
69d4cac760 Merge branch 'release' 2016-09-16 21:03:54 +09:00
deepak1556
e7f1265b64 add save-to-disk disposition for new-window event 2016-09-16 16:30:26 +05:30
deepak1556
94faaf7d58 provide a default file name for downloads 2016-09-16 16:02:57 +05:30
deepak1556
d426d4ad90 add failing spec 2016-09-16 16:02:57 +05:30
gellert
64e53a17bd reverts subscriber api 2016-09-16 11:18:15 +02:00
Cheng Zhao
20d5a50ac9 Merge pull request #7178 from aichingm/master
🐧 Add support for different trash implementations
2016-09-16 17:43:09 +09:00
Cheng Zhao
9714348260 Merge pull request #6941 from deepak1556/blob_data_patch
protocol: provide blob uuid with uploadData
2016-09-16 17:01:15 +09:00
Plusb Preco
787bc85703 docs: Update Korean docs as upstream (#7211)
* 📝 Update `README-ko.md`

* Remove Korean readme specified header.
* Add Indonesia community link.

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Mark untranslated docs

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Add untranslated files

[ci skip]

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Update Korean docs as upstream

* 📝 Update `README-ko.md`

* Remove Korean readme specified header.
* Add Indonesia community link.

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Update Korean docs as upstream

* 📝 Mark untranslated docs

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Add untranslated files

[ci skip]

* 📝 Update Korean docs as upstream

[ci skip]

* 📝 Update Korean docs as upstream

* 📝 Correct readme name

[ci skip]

* 📝 Update Korean docs as upstream

[ci skip]
2016-09-15 09:27:10 -07:00
Cheng Zhao
e62e62292a Bump v1.4.0 2016-09-15 14:44:38 +09:00
Cheng Zhao
b84d29fb32 Merge pull request #7213 from electron/chrome-update
Update to Chrome 53.0.2785.113
2016-09-15 14:44:10 +09:00
Cheng Zhao
5be8104104 Update to Chrome 53.0.2785.113 2016-09-15 14:27:56 +09:00
Kevin Sawicki
eef42770c6 Don't load remote properties until they are accessed 2016-09-14 13:29:49 -07:00
Kevin Sawicki
f792c720f4 Allow spec to be run multiple times in same runner 2016-09-14 11:16:44 -07:00
Kevin Sawicki
359ab2f9b3 Only set members when members exist 2016-09-14 10:54:23 -07:00
Kevin Sawicki
bc13536208 Add failing spec for missing remote properties 2016-09-14 10:53:25 -07:00
Kevin Sawicki
0d4872755c Merge pull request #7195 from Joshua-Anderson/update-node-req
Update nodejs requirement for building on linux
2016-09-14 09:52:23 -07:00
Cheng Zhao
4627311c34 Merge pull request #7104 from electron/chrome53
Upgrade to Chrome 53 and Node 6.5.0
2016-09-14 22:18:08 +09:00
Cheng Zhao
dc2ced14b8 Node module version should be 50 2016-09-14 17:08:13 +09:00
deepak1556
eafb6307d5 fix crash when using geolocation api with enableHighAccuracy option 2016-09-14 16:23:01 +09:00
Cheng Zhao
fbac635687 Only emit finalUpdate found-in-page events
Since Chrome 53 all meaningful results of found-in-page are finalUpdate.
2016-09-14 16:23:01 +09:00
Cheng Zhao
5ccd0a24e9 Fix compatibility with canScroll 2016-09-14 16:23:01 +09:00
Cheng Zhao
f8bdc7437d module search paths have changed 2016-09-14 16:23:01 +09:00
Cheng Zhao
1de2b77ee4 Update to Node 6.5.0 2016-09-14 16:23:00 +09:00
Cheng Zhao
18fd3e0329 Fix js linting error 2016-09-14 16:23:00 +09:00
Cheng Zhao
a510642a25 finalUpdate can be false 2016-09-14 16:23:00 +09:00
Cheng Zhao
30dd65e3a9 Fix failing spec when refreshing test window 2016-09-14 16:23:00 +09:00
Cheng Zhao
5708e86a05 Fix API change of findInPage API 2016-09-14 16:23:00 +09:00
Cheng Zhao
937ae7ef8f Fix crash caused by new network parameters 2016-09-14 16:23:00 +09:00
Cheng Zhao
4c56c1c2b2 Fix crash in offscreen renderer 2016-09-14 16:22:59 +09:00
Cheng Zhao
6d8f900916 Fix building on Windows 2016-09-14 16:22:43 +09:00
Cheng Zhao
4aa292c7cd Fix building on Linux 2016-09-14 16:22:43 +09:00
Cheng Zhao
f28e8d7168 Fix API changes of Chrome 53 2016-09-14 16:22:43 +09:00
Cheng Zhao
2e0a1a8a64 Upgrade to Chrome 53 2016-09-14 16:22:41 +09:00
Joshua Anderson
56b40ae6d2 Update nodejs requirement for building on linux 2016-09-13 19:41:53 -07:00
Zeke Sikelianos
9e8b0953f3 fix indentation 2016-09-12 10:47:36 -07:00
Mario Aichinger
893fc2cd53 🐧 Add support for different trash implementations
Make the trash implemantation in MoveItemToTrash selectable via an environment variable
2016-09-12 10:41:23 +02:00
gellert
2435f1b660 lint fix 2016-09-09 23:50:01 +02:00
gellert
afb551e94a updates tests 2016-09-09 23:40:10 +02:00
gellert
5754f3aea0 update docs 2016-09-09 23:26:14 +02:00
gellert
d3dc66e308 adds scale factor check and simplifies frame subscription 2016-09-09 23:17:17 +02:00
Dave Townsend
313b2faa3c Add a guestinstance attribute to webviews reflecting their current guest
instance ID and allowing moving a guest instance to a new webview.
2016-09-09 10:32:05 -07:00
Zeke Sikelianos
18585204b7 wrap line to stay under 80 chars 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
3d40c720dd fix indentation and rename function 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
8d201ae1ad generate electron-api.json and upload with release 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
67c89b68d3 use new electron-docs-linter with node 4 support 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
5937d37fc5 move linting work to electron-docs-linter's new CLI 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
56a644d49f move electron.json to docs/api.json 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
0c54700b16 add electron.json (compiled to target 1.2.7 release) 2016-09-09 10:07:22 -07:00
Zeke Sikelianos
3a5bf51d1d add lint-docs script 2016-09-09 10:07:22 -07:00
deepak1556
7b85ca0301 create helper class to read blob data 2016-09-01 08:52:44 +05:30
deepak1556
5cbc8d5c71 fix ambiguous constructor call 2016-09-01 01:01:52 +05:30
deepak1556
be4bc6b7ef fix docs and update specs 2016-09-01 01:01:52 +05:30
deepak1556
d2e40d4fc1 update api to work on public url and uuid 2016-09-01 01:01:52 +05:30
deepak1556
a23e7ecf8f add docs 2016-09-01 01:01:52 +05:30
deepak1556
0fb2339e3d session: api to retrieve blob data from uuid 2016-09-01 01:01:52 +05:30
deepak1556
2b0f632d51 provide blob uuid from upload data 2016-09-01 01:01:52 +05:30
472 changed files with 11757 additions and 4453 deletions

35
.clang-format Normal file
View File

@@ -0,0 +1,35 @@
# Defines the Chromium style for automatic reformatting.
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium
# This defaults to 'Auto'. Explicitly set it for a while, so that
# 'vector<vector<int> >' in existing files gets formatted to
# 'vector<vector<int>>'. ('Auto' means that clang-format will only use
# 'int>>' if the file already contains at least one such instance.)
Standard: Cpp11
# Make sure code like:
# IPC_BEGIN_MESSAGE_MAP()
# IPC_MESSAGE_HANDLER(WidgetHostViewHost_Update, OnUpdate)
# IPC_END_MESSAGE_MAP()
# gets correctly indented.
MacroBlockBegin: "^\
BEGIN_MSG_MAP|\
BEGIN_MSG_MAP_EX|\
BEGIN_SAFE_MSG_MAP_EX|\
CR_BEGIN_MSG_MAP_EX|\
IPC_BEGIN_MESSAGE_MAP|\
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
IPC_STRUCT_BEGIN|\
IPC_STRUCT_BEGIN_WITH_PARENT|\
IPC_STRUCT_TRAITS_BEGIN|\
POLPARAMS_BEGIN|\
PPAPI_BEGIN_MESSAGE_MAP$"
MacroBlockEnd: "^\
CR_END_MSG_MAP|\
END_MSG_MAP|\
IPC_END_MESSAGE_MAP|\
IPC_PROTOBUF_MESSAGE_TRAITS_END|\
IPC_STRUCT_END|\
IPC_STRUCT_TRAITS_END|\
POLPARAMS_END|\
PPAPI_END_MESSAGE_MAP$"

View File

@@ -1,6 +1,6 @@
# Contributing to Electron
:memo: Available Translations: [Korean](https://github.com/electron/electron/tree/master/docs-translations/ko-KR/project/CONTRIBUTING.md) | [Simplified Chinese](https://github.com/electron/electron/tree/master/docs-translations/zh-CN/project/CONTRIBUTING.md)
:memo: Available Translations: [Korean](https://github.com/electron/electron/tree/master/docs-translations/ko-KR/project/CONTRIBUTING.md) | [Simplified Chinese](https://github.com/electron/electron/tree/master/docs-translations/zh-CN/project/CONTRIBUTING.md) | [Brazilian Portuguese](https://github.com/electron/electron/tree/master/docs-translations/pt-BR/project/CONTRIBUTING.md) | [Dutch](https://github.com/electron/electron/tree/master/docs-translations/nl/project/CONTRIBUTING.md)
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

View File

@@ -1,4 +1,4 @@
Copyright (c) 2014 GitHub Inc.
Copyright (c) 2016 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -2,7 +2,7 @@
[![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/kvxe4byi7jcxbe26/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron#info=devDependencies)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron?type=dev)
[![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)
:memo: Available Translations: [Korean](https://github.com/electron/electron/tree/master/docs-translations/ko-KR/project/README.md) | [Simplified Chinese](https://github.com/electron/electron/tree/master/docs-translations/zh-CN/project/README.md)
@@ -79,3 +79,7 @@ forums
Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron)
for a community maintained list of useful example apps, tools and resources.
## License
MIT © 2016 Github

View File

@@ -11,7 +11,9 @@
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/relauncher.h"
#include "atom/common/google_api_key.h"
#include "atom/common/options_switches.h"
#include "atom/renderer/atom_renderer_client.h"
#include "atom/renderer/atom_sandboxed_renderer_client.h"
#include "atom/utility/atom_content_utility_client.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
@@ -29,7 +31,7 @@ namespace {
const char* kRelauncherProcess = "relauncher";
bool IsBrowserProcess(base::CommandLine* cmd) {
std::string process_type = cmd->GetSwitchValueASCII(switches::kProcessType);
std::string process_type = cmd->GetSwitchValueASCII(::switches::kProcessType);
return process_type.empty();
}
@@ -72,7 +74,7 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Only enable logging when --enable-logging is specified.
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!command_line->HasSwitch(switches::kEnableLogging) &&
if (!command_line->HasSwitch(::switches::kEnableLogging) &&
!env->HasVar("ELECTRON_ENABLE_LOGGING")) {
settings.logging_dest = logging::LOG_NONE;
logging::SetMinLogLevel(logging::LOG_NUM_SEVERITIES);
@@ -115,17 +117,23 @@ void AtomMainDelegate::PreSandboxStartup() {
auto command_line = base::CommandLine::ForCurrentProcess();
std::string process_type = command_line->GetSwitchValueASCII(
switches::kProcessType);
::switches::kProcessType);
// Only append arguments for browser process.
if (!IsBrowserProcess(command_line))
return;
// Disable renderer sandbox for most of node's functions.
command_line->AppendSwitch(switches::kNoSandbox);
if (command_line->HasSwitch(switches::kEnableSandbox)) {
// Disable setuid sandbox since it is not longer required on linux(namespace
// sandbox is available on most distros).
command_line->AppendSwitch(::switches::kDisableSetuidSandbox);
} else {
// Disable renderer sandbox for most of node's functions.
command_line->AppendSwitch(::switches::kNoSandbox);
}
// Allow file:// URIs to read other file:// URIs by default.
command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
command_line->AppendSwitch(::switches::kAllowFileAccessFromFiles);
#if defined(OS_MACOSX)
// Enable AVFoundation.
@@ -140,7 +148,13 @@ content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
content::ContentRendererClient*
AtomMainDelegate::CreateContentRendererClient() {
renderer_client_.reset(new AtomRendererClient);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSandbox)) {
renderer_client_.reset(new AtomSandboxedRendererClient);
} else {
renderer_client_.reset(new AtomRendererClient);
}
return renderer_client_.get();
}

View File

@@ -14,6 +14,12 @@
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"
#if defined(OS_WIN)
#include "atom/common/api/atom_bindings.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/dictionary.h"
#endif
#include "atom/common/node_includes.h"
namespace atom {
@@ -51,6 +57,11 @@ int NodeMain(int argc, char *argv[]) {
if (node_debugger.IsRunning())
env->AssignToContext(v8::Debug::GetDebugContext());
#if defined(OS_WIN)
mate::Dictionary process(gin_env.isolate(), env->process_object());
process.SetMethod("log", &AtomBindings::Log);
#endif
node::LoadEnvironment(env);
bool more;

View File

@@ -37,6 +37,7 @@
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_switches.h"
#include "media/audio/audio_manager.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/ssl/ssl_cert_request_info.h"
@@ -490,6 +491,11 @@ void App::OnWillFinishLaunching() {
}
void App::OnFinishLaunching(const base::DictionaryValue& launch_info) {
#if defined(OS_LINUX)
// Set the application name for audio streams shown in external
// applications. Only affects pulseaudio currently.
media::AudioManager::SetGlobalAppName(Browser::Get()->GetName());
#endif
Emit("ready", launch_info);
}
@@ -525,6 +531,7 @@ void App::OnLogin(LoginHandler* login_handler,
void App::OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition,
const std::vector<base::string16>& features,
int render_process_id,
int render_frame_id) {
v8::Locker locker(isolate());
@@ -535,7 +542,10 @@ void App::OnCreateWindow(const GURL& target_url,
content::WebContents::FromRenderFrameHost(rfh);
if (web_contents) {
auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents);
api_web_contents->OnCreateWindow(target_url, frame_name, disposition);
api_web_contents->OnCreateWindow(target_url,
frame_name,
disposition,
features);
}
}
@@ -585,8 +595,9 @@ void App::SelectClientCertificate(
cert_request_info->client_certs[0].get());
}
void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
Emit("gpu-process-crashed");
void App::OnGpuProcessCrashed(base::TerminationStatus status) {
Emit("gpu-process-crashed",
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
}
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
@@ -596,7 +607,7 @@ base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
if (key >= 0)
succeed = PathService::Get(key, &path);
if (!succeed)
args->ThrowError("Failed to get path");
args->ThrowError("Failed to get '" + name + "' path");
return path;
}
@@ -604,7 +615,7 @@ void App::SetPath(mate::Arguments* args,
const std::string& name,
const base::FilePath& path) {
if (!path.IsAbsolute()) {
args->ThrowError("path must be absolute");
args->ThrowError("Path must be absolute");
return;
}
@@ -839,6 +850,8 @@ void App::BuildPrototype(
base::Bind(&Browser::SetUserActivity, browser))
.SetMethod("getCurrentActivityType",
base::Bind(&Browser::GetCurrentActivityType, browser))
.SetMethod("setAboutPanelOptions",
base::Bind(&Browser::SetAboutPanelOptions, browser))
#endif
#if defined(OS_WIN)
.SetMethod("setUserTasks", base::Bind(&Browser::SetUserTasks, browser))

View File

@@ -6,6 +6,7 @@
#define ATOM_BROWSER_API_ATOM_API_APP_H_
#include <string>
#include <vector>
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/atom_browser_client.h"
@@ -50,6 +51,7 @@ class App : public AtomBrowserClient::Delegate,
void OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition,
const std::vector<base::string16>& features,
int render_process_id,
int render_frame_id);
@@ -102,7 +104,7 @@ class App : public AtomBrowserClient::Delegate,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
// content::GpuDataManagerObserver:
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
void OnGpuProcessCrashed(base::TerminationStatus status) override;
private:
// Get/Set the pre-defined path in PathService.

View File

@@ -7,12 +7,13 @@
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/node_includes.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "content/public/browser/tracing_controller.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
using content::TracingController;
namespace mate {

View File

@@ -20,6 +20,7 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
using atom::AtomCookieDelegate;
using content::BrowserThread;
namespace mate {
@@ -54,6 +55,27 @@ struct Converter<net::CanonicalCookie> {
}
};
template<>
struct Converter<AtomCookieDelegate::ChangeCause> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const AtomCookieDelegate::ChangeCause& val) {
switch (val) {
case AtomCookieDelegate::ChangeCause::CHANGE_COOKIE_EXPLICIT:
return mate::StringToV8(isolate, "explicit");
case AtomCookieDelegate::ChangeCause::CHANGE_COOKIE_OVERWRITE:
return mate::StringToV8(isolate, "overwrite");
case AtomCookieDelegate::ChangeCause::CHANGE_COOKIE_EXPIRED:
return mate::StringToV8(isolate, "expired");
case AtomCookieDelegate::ChangeCause::CHANGE_COOKIE_EVICTED:
return mate::StringToV8(isolate, "evicted");
case AtomCookieDelegate::ChangeCause::CHANGE_COOKIE_EXPIRED_OVERWRITE:
return mate::StringToV8(isolate, "expired-overwrite");
default:
return mate::StringToV8(isolate, "unknown");
}
}
};
} // namespace mate
namespace atom {
@@ -206,11 +228,14 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
Cookies::Cookies(v8::Isolate* isolate,
AtomBrowserContext* browser_context)
: request_context_getter_(browser_context->url_request_context_getter()) {
: request_context_getter_(browser_context->url_request_context_getter()),
cookie_delegate_(browser_context->cookie_delegate()) {
Init(isolate);
cookie_delegate_->AddObserver(this);
}
Cookies::~Cookies() {
cookie_delegate_->RemoveObserver(this);
}
void Cookies::Get(const base::DictionaryValue& filter,
@@ -239,6 +264,13 @@ void Cookies::Set(const base::DictionaryValue& details,
base::Bind(SetCookieOnIO, getter, Passed(&copied), callback));
}
void Cookies::OnCookieChanged(const net::CanonicalCookie& cookie,
bool removed,
AtomCookieDelegate::ChangeCause cause) {
Emit("changed", cookie, cause, removed);
}
// static
mate::Handle<Cookies> Cookies::Create(
v8::Isolate* isolate,

View File

@@ -8,6 +8,7 @@
#include <string>
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/net/atom_cookie_delegate.h"
#include "base/callback.h"
#include "native_mate/handle.h"
#include "net/cookies/canonical_cookie.h"
@@ -26,7 +27,8 @@ class AtomBrowserContext;
namespace api {
class Cookies : public mate::TrackableObject<Cookies> {
class Cookies : public mate::TrackableObject<Cookies>,
public AtomCookieDelegate::Observer {
public:
enum Error {
SUCCESS,
@@ -52,8 +54,14 @@ class Cookies : public mate::TrackableObject<Cookies> {
const base::Closure& callback);
void Set(const base::DictionaryValue& details, const SetCallback& callback);
// AtomCookieDelegate::Observer:
void OnCookieChanged(const net::CanonicalCookie& cookie,
bool removed,
AtomCookieDelegate::ChangeCause cause) override;
private:
net::URLRequestContextGetter* request_context_getter_;
scoped_refptr<AtomCookieDelegate> cookie_delegate_;
DISALLOW_COPY_AND_ASSIGN(Cookies);
};

View File

@@ -9,7 +9,6 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "content/public/browser/devtools_agent_host.h"
@@ -17,6 +16,8 @@
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
using content::DevToolsAgentHost;
namespace atom {
@@ -107,7 +108,7 @@ bool Debugger::IsAttached() {
void Debugger::Detach() {
if (!agent_host_.get())
return;
agent_host_->DetachClient();
agent_host_->DetachClient(this);
AgentHostClosed(agent_host_.get(), false);
agent_host_ = nullptr;
}
@@ -136,7 +137,7 @@ void Debugger::SendCommand(mate::Arguments* args) {
std::string json_args;
base::JSONWriter::Write(request, &json_args);
agent_host_->DispatchProtocolMessage(json_args);
agent_host_->DispatchProtocolMessage(this, json_args);
}
// static

View File

@@ -10,12 +10,13 @@
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
#include "atom/common/node_includes.h"
namespace mate {
template<>
@@ -134,7 +135,7 @@ std::string DownloadItem::GetFilename() const {
std::string(),
download_item_->GetSuggestedFilename(),
GetMimeType(),
std::string()).LossyDisplayName());
"download").LossyDisplayName());
}
std::string DownloadItem::GetContentDisposition() const {

View File

@@ -5,11 +5,12 @@
#include "atom/browser/api/atom_api_power_monitor.h"
#include "atom/browser/browser.h"
#include "atom/common/node_includes.h"
#include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_monitor_device_source.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
@@ -43,7 +44,7 @@ v8::Local<v8::Value> PowerMonitor::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate,
"Cannot initialize \"power-monitor\" module before app is ready")));
"Cannot require \"powerMonitor\" module before app is ready")));
return v8::Null(isolate);
}

View File

@@ -6,18 +6,19 @@
#include <string>
#include "atom/common/node_includes.h"
#include "content/public/browser/power_save_blocker.h"
#include "content/public/browser/browser_thread.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace mate {
template<>
struct Converter<content::PowerSaveBlocker::PowerSaveBlockerType> {
struct Converter<device::PowerSaveBlocker::PowerSaveBlockerType> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::PowerSaveBlocker::PowerSaveBlockerType* out) {
using content::PowerSaveBlocker;
device::PowerSaveBlocker::PowerSaveBlockerType* out) {
using device::PowerSaveBlocker;
std::string type;
if (!ConvertFromV8(isolate, val, &type))
return false;
@@ -39,7 +40,7 @@ namespace api {
PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
: current_blocker_type_(
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) {
device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) {
Init(isolate);
}
@@ -58,30 +59,34 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
// higher precedence level than |kPowerSaveBlockPreventAppSuspension|.
//
// Only the highest-precedence blocker type takes effect.
content::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type =
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension;
device::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type =
device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension;
for (const auto& element : power_save_blocker_types_) {
if (element.second ==
content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) {
device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) {
new_blocker_type =
content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep;
device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep;
break;
}
}
if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) {
std::unique_ptr<content::PowerSaveBlocker> new_blocker =
content::PowerSaveBlocker::Create(
std::unique_ptr<device::PowerSaveBlocker> new_blocker(
new device::PowerSaveBlocker(
new_blocker_type,
content::PowerSaveBlocker::kReasonOther,
ATOM_PRODUCT_NAME);
device::PowerSaveBlocker::kReasonOther,
ATOM_PRODUCT_NAME,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE)));
power_save_blocker_.swap(new_blocker);
current_blocker_type_ = new_blocker_type;
}
}
int PowerSaveBlocker::Start(
content::PowerSaveBlocker::PowerSaveBlockerType type) {
device::PowerSaveBlocker::PowerSaveBlockerType type) {
static int count = 0;
power_save_blocker_types_[count] = type;
UpdatePowerSaveBlocker();

View File

@@ -9,7 +9,7 @@
#include <memory>
#include "atom/browser/api/trackable_object.h"
#include "content/public/browser/power_save_blocker.h"
#include "device/power_save_blocker/power_save_blocker.h"
#include "native_mate/handle.h"
namespace mate {
@@ -33,18 +33,18 @@ class PowerSaveBlocker : public mate::TrackableObject<PowerSaveBlocker> {
private:
void UpdatePowerSaveBlocker();
int Start(content::PowerSaveBlocker::PowerSaveBlockerType type);
int Start(device::PowerSaveBlocker::PowerSaveBlockerType type);
bool Stop(int id);
bool IsStarted(int id);
std::unique_ptr<content::PowerSaveBlocker> power_save_blocker_;
std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_;
// Currnet blocker type used by |power_save_blocker_|
content::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_;
device::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_;
// Map from id to the corresponding blocker type for each request.
using PowerSaveBlockerTypeMap =
std::map<int, content::PowerSaveBlocker::PowerSaveBlockerType>;
std::map<int, device::PowerSaveBlocker::PowerSaveBlockerType>;
PowerSaveBlockerTypeMap power_save_blocker_types_;
DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker);

View File

@@ -7,11 +7,12 @@
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "content/public/browser/render_process_host.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {

View File

@@ -97,7 +97,7 @@ v8::Local<v8::Value> Screen::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate,
"Cannot initialize \"screen\" module before app is ready")));
"Cannot require \"screen\" module before app is ready")));
return v8::Null(isolate);
}

View File

@@ -49,6 +49,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/l10n/l10n_util.h"
using atom::api::Cookies;
using content::BrowserThread;
using content::StoragePartition;
@@ -335,7 +336,7 @@ void OnClearStorageDataDone(const base::Closure& callback) {
Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
: devtools_network_emulation_client_id_(base::GenerateGUID()),
browser_context_(browser_context) {
// Observe DownloadManger to get download notifications.
// Observe DownloadManager to get download notifications.
content::BrowserContext::GetDownloadManager(browser_context)->
AddObserver(this);
@@ -504,9 +505,24 @@ std::string Session::GetUserAgent() {
return browser_context_->GetUserAgent();
}
void Session::GetBlobData(
const std::string& uuid,
const AtomBlobReader::CompletionCallback& callback) {
if (callback.is_null())
return;
AtomBlobReader* blob_reader =
browser_context()->GetBlobReader();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AtomBlobReader::StartReading,
base::Unretained(blob_reader),
uuid,
callback));
}
v8::Local<v8::Value> Session::Cookies(v8::Isolate* isolate) {
if (cookies_.IsEmpty()) {
auto handle = atom::api::Cookies::Create(isolate, browser_context());
auto handle = Cookies::Create(isolate, browser_context());
cookies_.Reset(isolate, handle.ToV8());
}
return v8::Local<v8::Value>::New(isolate, cookies_);
@@ -586,6 +602,7 @@ void Session::BuildPrototype(v8::Isolate* isolate,
&Session::AllowNTLMCredentialsForDomains)
.SetMethod("setUserAgent", &Session::SetUserAgent)
.SetMethod("getUserAgent", &Session::GetUserAgent)
.SetMethod("getBlobData", &Session::GetBlobData)
.SetProperty("cookies", &Session::Cookies)
.SetProperty("protocol", &Session::Protocol)
.SetProperty("webRequest", &Session::WebRequest);
@@ -615,6 +632,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("Session", Session::GetConstructor(isolate)->GetFunction());
dict.Set("Cookies", Cookies::GetConstructor(isolate)->GetFunction());
dict.SetMethod("fromPartition", &FromPartition);
}

View File

@@ -8,6 +8,7 @@
#include <string>
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/atom_blob_reader.h"
#include "base/values.h"
#include "content/public/browser/download_manager.h"
#include "native_mate/handle.h"
@@ -76,6 +77,8 @@ class Session: public mate::TrackableObject<Session>,
void AllowNTLMCredentialsForDomains(const std::string& domains);
void SetUserAgent(const std::string& user_agent, mate::Arguments* args);
std::string GetUserAgent();
void GetBlobData(const std::string& uuid,
const AtomBlobReader::CompletionCallback& callback);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);

View File

@@ -8,34 +8,36 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
#endif
#include "ui/gfx/color_utils.h"
namespace atom {
namespace api {
SystemPreferences::SystemPreferences(v8::Isolate* isolate) {
SystemPreferences::SystemPreferences(v8::Isolate* isolate)
#if defined(OS_WIN)
: color_change_listener_(this)
#endif
{
Init(isolate);
#if defined(OS_WIN)
InitializeWindow();
#endif
}
SystemPreferences::~SystemPreferences() {
}
#if defined(OS_WIN)
bool SystemPreferences::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}
#endif
#if !defined(OS_MACOSX)
bool SystemPreferences::IsDarkMode() {
return false;
}
#endif
bool SystemPreferences::IsInvertedColorScheme() {
return color_utils::IsInvertedColorScheme();
}
// static
mate::Handle<SystemPreferences> SystemPreferences::Create(
v8::Isolate* isolate) {
@@ -48,7 +50,9 @@ void SystemPreferences::BuildPrototype(
prototype->SetClassName(mate::StringToV8(isolate, "SystemPreferences"));
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
#if defined(OS_WIN)
.SetMethod("getAccentColor", &SystemPreferences::GetAccentColor)
.SetMethod("isAeroGlassEnabled", &SystemPreferences::IsAeroGlassEnabled)
.SetMethod("getColor", &SystemPreferences::GetColor)
#elif defined(OS_MACOSX)
.SetMethod("postNotification",
&SystemPreferences::PostNotification)
@@ -66,6 +70,8 @@ void SystemPreferences::BuildPrototype(
.SetMethod("isSwipeTrackingFromScrollEventsEnabled",
&SystemPreferences::IsSwipeTrackingFromScrollEventsEnabled)
#endif
.SetMethod("isInvertedColorScheme",
&SystemPreferences::IsInvertedColorScheme)
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
}

View File

@@ -12,6 +12,10 @@
#include "base/values.h"
#include "native_mate/handle.h"
#if defined(OS_WIN)
#include "ui/gfx/sys_color_change_listener.h"
#endif
namespace base {
class DictionaryValue;
}
@@ -20,7 +24,11 @@ namespace atom {
namespace api {
class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
class SystemPreferences : public mate::EventEmitter<SystemPreferences>
#if defined(OS_WIN)
, public gfx::SysColorChangeListener
#endif
{
public:
static mate::Handle<SystemPreferences> Create(v8::Isolate* isolate);
@@ -29,6 +37,20 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
#if defined(OS_WIN)
bool IsAeroGlassEnabled();
typedef HRESULT (STDAPICALLTYPE *DwmGetColorizationColor)(DWORD *, BOOL *);
DwmGetColorizationColor dwmGetColorizationColor =
(DwmGetColorizationColor) GetProcAddress(LoadLibraryW(L"dwmapi.dll"),
"DwmGetColorizationColor");
std::string GetAccentColor();
std::string GetColor(const std::string& color, mate::Arguments* args);
void InitializeWindow();
// gfx::SysColorChangeListener:
void OnSysColorChange() override;
#elif defined(OS_MACOSX)
using NotificationCallback = base::Callback<
void(const std::string&, const base::DictionaryValue&)>;
@@ -48,6 +70,7 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
bool IsSwipeTrackingFromScrollEventsEnabled();
#endif
bool IsDarkMode();
bool IsInvertedColorScheme();
protected:
explicit SystemPreferences(v8::Isolate* isolate);
@@ -64,6 +87,29 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
#endif
private:
#if defined(OS_WIN)
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK
WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
// The window class of |window_|.
ATOM atom_;
// The handle of the module that contains the window procedure of |window_|.
HMODULE instance_;
// The window used for processing events.
HWND window_;
std::string current_color_;
bool invertered_color_scheme_;
gfx::ScopedSysColorChangeListener color_change_listener_;
#endif
DISALLOW_COPY_AND_ASSIGN(SystemPreferences);
};

View File

@@ -0,0 +1,177 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/api/atom_api_system_preferences.h"
#include "atom/common/color_util.h"
#include "base/win/wrapped_window_proc.h"
#include "ui/base/win/shell.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/win/hwnd_util.h"
namespace atom {
namespace {
const wchar_t kSystemPreferencesWindowClass[] =
L"Electron_SystemPreferencesHostWindow";
} // namespace
namespace api {
bool SystemPreferences::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}
std::string hexColorDWORDToRGBA(DWORD color) {
std::ostringstream stream;
stream << std::hex << color;
std::string hexColor = stream.str();
return hexColor.substr(2) + hexColor.substr(0, 2);
}
std::string SystemPreferences::GetAccentColor() {
DWORD color = 0;
BOOL opaque = FALSE;
if (FAILED(dwmGetColorizationColor(&color, &opaque))) {
return "";
}
return hexColorDWORDToRGBA(color);
}
std::string SystemPreferences::GetColor(const std::string& color,
mate::Arguments* args) {
int id;
if (color == "3d-dark-shadow") {
id = COLOR_3DDKSHADOW;
} else if (color == "3d-face") {
id = COLOR_3DFACE;
} else if (color == "3d-highlight") {
id = COLOR_3DHIGHLIGHT;
} else if (color == "3d-light") {
id = COLOR_3DLIGHT;
} else if (color == "3d-shadow") {
id = COLOR_3DSHADOW;
} else if (color == "active-border") {
id = COLOR_ACTIVEBORDER;
} else if (color == "active-caption") {
id = COLOR_ACTIVECAPTION;
} else if (color == "active-caption-gradient") {
id = COLOR_GRADIENTACTIVECAPTION;
} else if (color == "app-workspace") {
id = COLOR_APPWORKSPACE;
} else if (color == "button-text") {
id = COLOR_BTNTEXT;
} else if (color == "caption-text") {
id = COLOR_CAPTIONTEXT;
} else if (color == "desktop") {
id = COLOR_DESKTOP;
} else if (color == "disabled-text") {
id = COLOR_GRAYTEXT;
} else if (color == "highlight") {
id = COLOR_HIGHLIGHT;
} else if (color == "highlight-text") {
id = COLOR_HIGHLIGHTTEXT;
} else if (color == "hotlight") {
id = COLOR_HOTLIGHT;
} else if (color == "inactive-border") {
id = COLOR_INACTIVEBORDER;
} else if (color == "inactive-caption") {
id = COLOR_INACTIVECAPTION;
} else if (color == "inactive-caption-gradient") {
id = COLOR_GRADIENTINACTIVECAPTION;
} else if (color == "inactive-caption-text") {
id = COLOR_INACTIVECAPTIONTEXT;
} else if (color == "info-background") {
id = COLOR_INFOBK;
} else if (color == "info-text") {
id = COLOR_INFOTEXT;
} else if (color == "menu") {
id = COLOR_MENU;
} else if (color == "menu-highlight") {
id = COLOR_MENUHILIGHT;
} else if (color == "menubar") {
id = COLOR_MENUBAR;
} else if (color == "menu-text") {
id = COLOR_MENUTEXT;
} else if (color == "scrollbar") {
id = COLOR_SCROLLBAR;
} else if (color == "window") {
id = COLOR_WINDOW;
} else if (color == "window-frame") {
id = COLOR_WINDOWFRAME;
} else if (color == "window-text") {
id = COLOR_WINDOWTEXT;
} else {
args->ThrowError("Unknown color: " + color);
return "";
}
return ToRGBHex(color_utils::GetSysSkColor(id));
}
void SystemPreferences::InitializeWindow() {
invertered_color_scheme_ = IsInvertedColorScheme();
WNDCLASSEX window_class;
base::win::InitializeWindowClass(
kSystemPreferencesWindowClass,
&base::win::WrappedWindowProc<SystemPreferences::WndProcStatic>,
0, 0, 0, NULL, NULL, NULL, NULL, NULL,
&window_class);
instance_ = window_class.hInstance;
atom_ = RegisterClassEx(&window_class);
// Create an offscreen window for receiving broadcast messages for the system
// colorization color. Create a hidden WS_POPUP window instead of an
// HWND_MESSAGE window, because only top-level windows such as popups can
// receive broadcast messages like "WM_DWMCOLORIZATIONCOLORCHANGED".
window_ = CreateWindow(MAKEINTATOM(atom_),
0, WS_POPUP, 0, 0, 0, 0, 0, 0, instance_, 0);
gfx::CheckWindowCreated(window_);
gfx::SetWindowUserData(window_, this);
}
LRESULT CALLBACK SystemPreferences::WndProcStatic(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam) {
SystemPreferences* msg_wnd = reinterpret_cast<SystemPreferences*>(
GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (msg_wnd)
return msg_wnd->WndProc(hwnd, message, wparam, lparam);
else
return ::DefWindowProc(hwnd, message, wparam, lparam);
}
LRESULT CALLBACK SystemPreferences::WndProc(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam) {
if (message == WM_DWMCOLORIZATIONCOLORCHANGED) {
DWORD new_color = (DWORD) wparam;
std::string new_color_string = hexColorDWORDToRGBA(new_color);
if (new_color_string != current_color_) {
Emit("accent-color-changed", hexColorDWORDToRGBA(new_color));
current_color_ = new_color_string;
}
}
return ::DefWindowProc(hwnd, message, wparam, lparam);
}
void SystemPreferences::OnSysColorChange() {
bool new_invertered_color_scheme = IsInvertedColorScheme();
if (new_invertered_color_scheme != invertered_color_scheme_) {
invertered_color_scheme_ = new_invertered_color_scheme;
Emit("inverted-color-scheme-changed", new_invertered_color_scheme);
}
Emit("color-changed");
}
} // namespace api
} // namespace atom

View File

@@ -37,7 +37,6 @@
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -77,6 +76,8 @@
#include "ui/aura/window.h"
#endif
#include "atom/common/node_includes.h"
namespace {
struct PrintSettings {
@@ -133,6 +134,7 @@ struct Converter<WindowOpenDisposition> {
case NEW_FOREGROUND_TAB: disposition = "foreground-tab"; break;
case NEW_BACKGROUND_TAB: disposition = "background-tab"; break;
case NEW_POPUP: case NEW_WINDOW: disposition = "new-window"; break;
case SAVE_TO_DISK: disposition = "save-to-disk"; break;
default: break;
}
return mate::ConvertToV8(isolate, disposition);
@@ -256,17 +258,25 @@ void OnCapturePageDone(base::Callback<void(const gfx::Image&)> callback,
} // namespace
WebContents::WebContents(v8::Isolate* isolate,
content::WebContents* web_contents)
content::WebContents* web_contents,
Type type)
: content::WebContentsObserver(web_contents),
embedder_(nullptr),
type_(REMOTE),
type_(type),
request_id_(0),
background_throttling_(true),
enable_devtools_(true) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
Init(isolate);
AttachAsUserData(web_contents);
if (type == REMOTE) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
Init(isolate);
AttachAsUserData(web_contents);
} else {
const mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
auto session = Session::CreateFrom(isolate, GetBrowserContext());
session_.Reset(isolate, session.ToV8());
InitWithSessionAndOptions(isolate, web_contents, session, options);
}
}
WebContents::WebContents(v8::Isolate* isolate,
@@ -334,6 +344,13 @@ WebContents::WebContents(v8::Isolate* isolate,
web_contents = content::WebContents::Create(params);
}
InitWithSessionAndOptions(isolate, web_contents, session, options);
}
void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
content::WebContents *web_contents,
mate::Handle<api::Session> session,
const mate::Dictionary& options) {
Observe(web_contents);
InitWithWebContents(web_contents, session->browser_context());
@@ -399,11 +416,37 @@ bool WebContents::AddMessageToConsole(content::WebContents* source,
void WebContents::OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition) {
WindowOpenDisposition disposition,
const std::vector<base::string16>& features) {
if (type_ == BROWSER_WINDOW || type_ == OFF_SCREEN)
Emit("-new-window", target_url, frame_name, disposition);
Emit("-new-window", target_url, frame_name, disposition, features);
else
Emit("new-window", target_url, frame_name, disposition);
Emit("new-window", target_url, frame_name, disposition, features);
}
void WebContents::WebContentsCreated(content::WebContents* source_contents,
int opener_render_frame_id,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto api_web_contents = CreateFrom(isolate(), new_contents, BROWSER_WINDOW);
Emit("-web-contents-created", api_web_contents, target_url, frame_name);
}
void WebContents::AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto api_web_contents = CreateFrom(isolate(), new_contents);
Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
initial_rect.x(), initial_rect.y(), initial_rect.width(),
initial_rect.height());
}
content::WebContents* WebContents::OpenURLFromTab(
@@ -527,22 +570,18 @@ void WebContents::FindReply(content::WebContents* web_contents,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
if (!final_update)
return;
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
mate::Dictionary result = mate::Dictionary::CreateEmpty(isolate());
if (number_of_matches == -1) {
result.Set("requestId", request_id);
result.Set("selectionArea", selection_rect);
result.Set("finalUpdate", final_update);
result.Set("activeMatchOrdinal", active_match_ordinal);
Emit("found-in-page", result);
} else if (final_update) {
result.Set("requestId", request_id);
result.Set("matches", number_of_matches);
result.Set("finalUpdate", final_update);
Emit("found-in-page", result);
}
result.Set("requestId", request_id);
result.Set("matches", number_of_matches);
result.Set("selectionArea", selection_rect);
result.Set("activeMatchOrdinal", active_match_ordinal);
result.Set("finalUpdate", final_update); // Deprecate after 2.0
Emit("found-in-page", result);
}
bool WebContents::CheckMediaAccessPermission(
@@ -588,7 +627,7 @@ void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
}
void WebContents::RenderProcessGone(base::TerminationStatus status) {
Emit("crashed");
Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
}
void WebContents::PluginCrashed(const base::FilePath& plugin_path,
@@ -608,11 +647,7 @@ void WebContents::MediaStoppedPlaying(const MediaPlayerId& id) {
}
void WebContents::DidChangeThemeColor(SkColor theme_color) {
std::string hex_theme_color = base::StringPrintf("#%02X%02X%02X",
SkColorGetR(theme_color),
SkColorGetG(theme_color),
SkColorGetB(theme_color));
Emit("did-change-theme-color", hex_theme_color);
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
}
void WebContents::DocumentLoadedInFrame(
@@ -803,7 +838,14 @@ void WebContents::NavigationEntryCommitted(
details.is_in_page, details.did_replace_entry);
}
int WebContents::GetID() const {
int64_t WebContents::GetID() const {
int64_t process_id = web_contents()->GetRenderProcessHost()->GetID();
int64_t routing_id = web_contents()->GetRoutingID();
int64_t rv = (process_id << 32) + routing_id;
return rv;
}
int WebContents::GetProcessID() const {
return web_contents()->GetRenderProcessHost()->GetID();
}
@@ -871,7 +913,8 @@ void WebContents::DownloadURL(const GURL& url) {
content::BrowserContext::GetDownloadManager(browser_context);
download_manager->DownloadUrl(
content::DownloadUrlParameters::FromWebContents(web_contents(), url));
content::DownloadUrlParameters::CreateForWebContentsMainFrame(
web_contents(), url));
}
GURL WebContents::GetURL() const {
@@ -1177,7 +1220,7 @@ void WebContents::ShowDefinitionForSelection() {
}
void WebContents::CopyImageAt(int x, int y) {
const auto host = web_contents()->GetRenderViewHost();
const auto host = web_contents()->GetMainFrame();
if (host)
host->CopyImageAt(x, y);
}
@@ -1419,6 +1462,15 @@ int WebContents::GetFrameRate() const {
return osr_rwhv ? osr_rwhv->GetFrameRate() : 0;
}
void WebContents::Invalidate() {
if (!IsOffScreen())
return;
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
web_contents()->GetRenderWidgetHostView());
if (osr_rwhv)
osr_rwhv->Invalidate();
}
v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
WebContentsPreferences* web_preferences =
@@ -1447,6 +1499,25 @@ content::WebContents* WebContents::HostWebContents() {
return embedder_->web_contents();
}
void WebContents::SetEmbedder(const WebContents* embedder) {
if (embedder) {
NativeWindow* owner_window = nullptr;
auto relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
if (relay) {
owner_window = relay->window.get();
}
if (owner_window)
SetOwnerWindow(owner_window);
content::RenderWidgetHostView* rwhv =
web_contents()->GetRenderWidgetHostView();
if (rwhv) {
rwhv->Hide();
rwhv->Show();
}
}
}
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
if (devtools_web_contents_.IsEmpty())
return v8::Null(isolate);
@@ -1469,6 +1540,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.MakeDestroyable()
.SetMethod("getId", &WebContents::GetID)
.SetMethod("getProcessId", &WebContents::GetProcessID)
.SetMethod("equal", &WebContents::Equal)
.SetMethod("_loadURL", &WebContents::LoadURL)
.SetMethod("downloadURL", &WebContents::DownloadURL)
@@ -1528,6 +1600,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isPainting", &WebContents::IsPainting)
.SetMethod("setFrameRate", &WebContents::SetFrameRate)
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
.SetMethod("invalidate", &WebContents::Invalidate)
.SetMethod("getType", &WebContents::GetType)
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
@@ -1543,6 +1616,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
&WebContents::ShowDefinitionForSelection)
.SetMethod("copyImageAt", &WebContents::CopyImageAt)
.SetMethod("capturePage", &WebContents::CapturePage)
.SetMethod("setEmbedder", &WebContents::SetEmbedder)
.SetProperty("id", &WebContents::ID)
.SetProperty("session", &WebContents::Session)
.SetProperty("hostWebContents", &WebContents::HostWebContents)
@@ -1576,7 +1650,15 @@ mate::Handle<WebContents> WebContents::CreateFrom(
return mate::CreateHandle(isolate, static_cast<WebContents*>(existing));
// Otherwise create a new WebContents wrapper object.
return mate::CreateHandle(isolate, new WebContents(isolate, web_contents));
return mate::CreateHandle(isolate, new WebContents(isolate, web_contents,
REMOTE));
}
mate::Handle<WebContents> WebContents::CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents, Type type) {
// Otherwise create a new WebContents wrapper object.
return mate::CreateHandle(isolate, new WebContents(isolate, web_contents,
type));
}
// static

View File

@@ -58,6 +58,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Create from an existing WebContents.
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents);
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents, Type type);
// Create a new WebContents.
static mate::Handle<WebContents> Create(
@@ -66,7 +68,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
int GetID() const;
int64_t GetID() const;
int GetProcessID() const;
Type GetType() const;
bool Equal(const WebContents* web_contents) const;
void LoadURL(const GURL& url, const mate::Dictionary& options);
@@ -102,6 +105,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetAudioMuted(bool muted);
bool IsAudioMuted();
void Print(mate::Arguments* args);
void SetEmbedder(const WebContents* embedder);
// Print current page as PDF.
void PrintToPDF(const base::DictionaryValue& setting,
@@ -164,6 +168,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
bool IsPainting() const;
void SetFrameRate(int frame_rate);
int GetFrameRate() const;
void Invalidate();
// Callback triggered on permission response.
void OnEnterFullscreenModeForTab(content::WebContents* source,
@@ -173,7 +178,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Create window with the given disposition.
void OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition);
WindowOpenDisposition disposition,
const std::vector<base::string16>& features);
// Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
@@ -189,16 +195,34 @@ class WebContents : public mate::TrackableObject<WebContents>,
v8::Local<v8::Value> Debugger(v8::Isolate* isolate);
protected:
WebContents(v8::Isolate* isolate, content::WebContents* web_contents);
WebContents(v8::Isolate* isolate,
content::WebContents* web_contents,
Type type);
WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
~WebContents();
void InitWithSessionAndOptions(v8::Isolate* isolate,
content::WebContents *web_contents,
mate::Handle<class Session> session,
const mate::Dictionary& options);
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,
int32_t level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
void WebContentsCreated(content::WebContents* source_contents,
int opener_render_frame_id,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;

View File

@@ -14,7 +14,6 @@
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "content/public/browser/render_process_host.h"
@@ -31,6 +30,8 @@
#include "atom/browser/ui/win/taskbar_host.h"
#endif
#include "atom/common/node_includes.h"
#if defined(OS_WIN)
namespace mate {
@@ -71,20 +72,33 @@ v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
Window::Window(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
const mate::Dictionary& options) {
// Use options.webPreferences to create WebContents.
mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
options.Get(options::kWebPreferences, &web_preferences);
mate::Handle<class WebContents> web_contents;
// If no WebContents was passed to the constructor, create it from options.
if (!options.Get("webContents", &web_contents)) {
// Use options.webPreferences to create WebContents.
mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
options.Get(options::kWebPreferences, &web_preferences);
// Copy the backgroundColor to webContents.
v8::Local<v8::Value> value;
if (options.Get(options::kBackgroundColor, &value))
web_preferences.Set(options::kBackgroundColor, value);
// Copy the backgroundColor to webContents.
v8::Local<v8::Value> value;
if (options.Get(options::kBackgroundColor, &value))
web_preferences.Set(options::kBackgroundColor, value);
v8::Local<v8::Value> transparent;
if (options.Get("transparent", &transparent))
web_preferences.Set("transparent", transparent);
// Creates the WebContents used by BrowserWindow.
auto web_contents = WebContents::Create(isolate, web_preferences);
v8::Local<v8::Value> transparent;
if (options.Get("transparent", &transparent))
web_preferences.Set("transparent", transparent);
// Creates the WebContents used by BrowserWindow.
web_contents = WebContents::Create(isolate, web_preferences);
}
Init(isolate, wrapper, options, web_contents);
}
void Window::Init(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,
const mate::Dictionary& options,
mate::Handle<class WebContents> web_contents) {
web_contents_.Reset(isolate, web_contents.ToV8());
api_web_contents_ = web_contents.get();
@@ -229,6 +243,10 @@ void Window::OnWindowScrollTouchEnd() {
Emit("scroll-touch-end");
}
void Window::OnWindowScrollTouchEdge() {
Emit("scroll-touch-edge");
}
void Window::OnWindowSwipe(const std::string& direction) {
Emit("swipe", direction);
}
@@ -481,8 +499,10 @@ bool Window::IsClosable() {
return window_->IsClosable();
}
void Window::SetAlwaysOnTop(bool top) {
window_->SetAlwaysOnTop(top);
void Window::SetAlwaysOnTop(bool top, mate::Arguments* args) {
std::string level = "floating";
args->GetNext(&level);
window_->SetAlwaysOnTop(top, level);
}
bool Window::IsAlwaysOnTop() {

View File

@@ -74,6 +74,7 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowMoved() override;
void OnWindowScrollTouchBegin() override;
void OnWindowScrollTouchEnd() override;
void OnWindowScrollTouchEdge() override;
void OnWindowSwipe(const std::string& direction) override;
void OnWindowEnterFullScreen() override;
void OnWindowLeaveFullScreen() override;
@@ -88,6 +89,10 @@ class Window : public mate::TrackableObject<Window>,
#endif
private:
void Init(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,
const mate::Dictionary& options,
mate::Handle<class WebContents> web_contents);
// APIs for NativeWindow.
void Close();
void Focus();
@@ -131,7 +136,7 @@ class Window : public mate::TrackableObject<Window>,
bool IsFullScreenable();
void SetClosable(bool closable);
bool IsClosable();
void SetAlwaysOnTop(bool top);
void SetAlwaysOnTop(bool top, mate::Arguments* args);
bool IsAlwaysOnTop();
void Center();
void SetPosition(int x, int y, mate::Arguments* args);

View File

@@ -5,9 +5,12 @@
#include "atom/browser/api/frame_subscriber.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/node_includes.h"
#include "base/bind.h"
#include "content/public/browser/render_widget_host.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "atom/common/node_includes.h"
namespace atom {
@@ -40,6 +43,17 @@ bool FrameSubscriber::ShouldCaptureFrame(
if (only_dirty_)
rect = dirty_rect;
gfx::Size view_size = rect.size();
gfx::Size bitmap_size = view_size;
const gfx::NativeView native_view = view_->GetNativeView();
const float scale =
display::Screen::GetScreen()->GetDisplayNearestWindow(native_view)
.device_scale_factor();
if (scale > 1.0f)
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
rect = gfx::Rect(rect.origin(), bitmap_size);
host->CopyFromBackingStore(
rect,
rect.size(),

View File

@@ -4,23 +4,67 @@
#include "atom/browser/atom_access_token_store.h"
#include <string>
#include <utility>
#include "atom/browser/atom_browser_context.h"
#include "atom/common/google_api_key.h"
#include "base/environment.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/geolocation_provider.h"
using content::BrowserThread;
namespace atom {
namespace {
// Notice that we just combined the api key with the url together here, because
// if we use the standard {url: key} format Chromium would override our key with
// the predefined one in common.gypi of libchromiumcontent, which is empty.
const char* kGeolocationProviderURL =
"https://www.googleapis.com/geolocation/v1/geolocate?key="
GOOGLEAPIS_API_KEY;
// Loads access tokens and other necessary data on the UI thread, and
// calls back to the originator on the originating thread.
class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
public:
explicit TokenLoadingJob(
const content::AccessTokenStore::LoadAccessTokensCallback& callback)
: callback_(callback), request_context_getter_(nullptr) {}
void Run() {
BrowserThread::PostTaskAndReply(
BrowserThread::UI,
FROM_HERE,
base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this),
base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this));
}
private:
friend class base::RefCountedThreadSafe<TokenLoadingJob>;
~TokenLoadingJob() {}
void PerformWorkOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto browser_context = AtomBrowserContext::From("", false);
request_context_getter_ = browser_context->GetRequestContext();
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!env->GetVar("GOOGLE_API_KEY", &api_key_))
api_key_ = GOOGLEAPIS_API_KEY;
}
void RespondOnOriginatingThread() {
// Equivalent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
content::AccessTokenStore::AccessTokenMap access_token_map;
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(GOOGLEAPIS_ENDPOINT + api_key_);
access_token_map.insert(token_pair);
callback_.Run(access_token_map, request_context_getter_);
}
content::AccessTokenStore::LoadAccessTokensCallback callback_;
net::URLRequestContextGetter* request_context_getter_;
std::string api_key_;
};
} // namespace
@@ -33,35 +77,12 @@ AtomAccessTokenStore::~AtomAccessTokenStore() {
void AtomAccessTokenStore::LoadAccessTokens(
const LoadAccessTokensCallback& callback) {
content::BrowserThread::PostTaskAndReply(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(&AtomAccessTokenStore::GetRequestContextOnUIThread, this),
base::Bind(&AtomAccessTokenStore::RespondOnOriginatingThread,
this, callback));
scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback));
job->Run();
}
void AtomAccessTokenStore::SaveAccessToken(const GURL& server_url,
const base::string16& access_token) {
}
void AtomAccessTokenStore::GetRequestContextOnUIThread() {
auto browser_context = AtomBrowserContext::From("", false);
request_context_getter_ = browser_context->GetRequestContext();
}
void AtomAccessTokenStore::RespondOnOriginatingThread(
const LoadAccessTokensCallback& callback) {
// Equivelent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
AccessTokenMap access_token_map;
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(kGeolocationProviderURL);
access_token_map.insert(token_pair);
callback.Run(access_token_map, request_context_getter_.get());
request_context_getter_ = nullptr;
}
} // namespace atom

View File

@@ -21,11 +21,6 @@ class AtomAccessTokenStore : public content::AccessTokenStore {
const base::string16& access_token) override;
private:
void GetRequestContextOnUIThread();
void RespondOnOriginatingThread(const LoadAccessTokensCallback& callback);
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);
};

View File

@@ -0,0 +1,138 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/atom_blob_reader.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/blob/blob_reader.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/fileapi/file_system_context.h"
#include "atom/common/node_includes.h"
using content::BrowserThread;
namespace atom {
namespace {
void FreeNodeBufferData(char* data, void* hint) {
delete[] data;
}
void RunCallbackInUI(
const AtomBlobReader::CompletionCallback& callback,
char* blob_data,
int size) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
if (blob_data) {
v8::Local<v8::Value> buffer = node::Buffer::New(isolate,
blob_data, static_cast<size_t>(size), &FreeNodeBufferData, nullptr)
.ToLocalChecked();
callback.Run(buffer);
} else {
callback.Run(v8::Null(isolate));
}
}
} // namespace
AtomBlobReader::AtomBlobReader(
content::ChromeBlobStorageContext* blob_context,
storage::FileSystemContext* file_system_context)
: blob_context_(blob_context),
file_system_context_(file_system_context) {
}
AtomBlobReader::~AtomBlobReader() {
}
void AtomBlobReader::StartReading(
const std::string& uuid,
const AtomBlobReader::CompletionCallback& completion_callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
auto blob_data_handle =
blob_context_->context()->GetBlobDataFromUUID(uuid);
auto callback = base::Bind(&RunCallbackInUI,
completion_callback);
if (!blob_data_handle) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(callback, nullptr, 0));
return;
}
auto blob_reader = blob_data_handle->CreateReader(
file_system_context_.get(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get());
BlobReadHelper* blob_read_helper =
new BlobReadHelper(std::move(blob_reader), callback);
blob_read_helper->Read();
}
AtomBlobReader::BlobReadHelper::BlobReadHelper(
std::unique_ptr<storage::BlobReader> blob_reader,
const BlobReadHelper::CompletionCallback& callback)
: blob_reader_(std::move(blob_reader)),
completion_callback_(callback) {
}
AtomBlobReader::BlobReadHelper::~BlobReadHelper() {
}
void AtomBlobReader::BlobReadHelper::Read() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
storage::BlobReader::Status size_status = blob_reader_->CalculateSize(
base::Bind(&AtomBlobReader::BlobReadHelper::DidCalculateSize,
base::Unretained(this)));
if (size_status != storage::BlobReader::Status::IO_PENDING)
DidCalculateSize(net::OK);
}
void AtomBlobReader::BlobReadHelper::DidCalculateSize(int result) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (result != net::OK) {
DidReadBlobData(nullptr, 0);
return;
}
uint64_t total_size = blob_reader_->total_size();
int bytes_read = 0;
scoped_refptr<net::IOBuffer> blob_data =
new net::IOBuffer(static_cast<size_t>(total_size));
auto callback = base::Bind(&AtomBlobReader::BlobReadHelper::DidReadBlobData,
base::Unretained(this),
base::RetainedRef(blob_data));
storage::BlobReader::Status read_status = blob_reader_->Read(
blob_data.get(),
total_size,
&bytes_read,
callback);
if (read_status != storage::BlobReader::Status::IO_PENDING)
callback.Run(bytes_read);
}
void AtomBlobReader::BlobReadHelper::DidReadBlobData(
const scoped_refptr<net::IOBuffer>& blob_data,
int size) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
char* data = new char[size];
memcpy(data, blob_data->data(), size);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(completion_callback_, data, size));
delete this;
}
} // namespace atom

View File

@@ -0,0 +1,80 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_BLOB_READER_H_
#define ATOM_BROWSER_ATOM_BLOB_READER_H_
#include <string>
#include "base/callback.h"
namespace content {
class ChromeBlobStorageContext;
}
namespace net {
class IOBuffer;
}
namespace storage {
class BlobDataHandle;
class BlobReader;
class FileSystemContext;
}
namespace v8 {
template <class T>
class Local;
class Value;
}
namespace atom {
// A class to keep track of the blob context. All methods,
// except Ctor are expected to be called on IO thread.
class AtomBlobReader {
public:
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>;
AtomBlobReader(content::ChromeBlobStorageContext* blob_context,
storage::FileSystemContext* file_system_context);
~AtomBlobReader();
void StartReading(
const std::string& uuid,
const AtomBlobReader::CompletionCallback& callback);
private:
// A self-destroyed helper class to read the blob data.
// Must be accessed on IO thread.
class BlobReadHelper {
public:
using CompletionCallback = base::Callback<void(char*, int)>;
BlobReadHelper(std::unique_ptr<storage::BlobReader> blob_reader,
const BlobReadHelper::CompletionCallback& callback);
~BlobReadHelper();
void Read();
private:
void DidCalculateSize(int result);
void DidReadBlobData(const scoped_refptr<net::IOBuffer>& blob_data,
int bytes_read);
std::unique_ptr<storage::BlobReader> blob_reader_;
BlobReadHelper::CompletionCallback completion_callback_;
DISALLOW_COPY_AND_ASSIGN(BlobReadHelper);
};
scoped_refptr<content::ChromeBlobStorageContext> blob_context_;
scoped_refptr<storage::FileSystemContext> file_system_context_;
DISALLOW_COPY_AND_ASSIGN(AtomBlobReader);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_BLOB_READER_H_

View File

@@ -32,11 +32,13 @@
#include "chrome/browser/speech/tts_message_filter.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/geolocation_delegate.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
@@ -53,6 +55,19 @@ bool g_suppress_renderer_process_restart = false;
// Custom schemes to be registered to handle service worker.
std::string g_custom_service_worker_schemes = "";
// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public content::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;
content::AccessTokenStore* CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}
private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};
void Noop(scoped_refptr<content::SiteInstance>) {
}
@@ -85,6 +100,44 @@ content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID(
return WebContentsPreferences::GetWebContentsFromProcessID(process_id);
}
bool AtomBrowserClient::ShouldCreateNewSiteInstance(
content::BrowserContext* browser_context,
content::SiteInstance* current_instance,
const GURL& url) {
if (url.SchemeIs(url::kJavaScriptScheme))
// "javacript:" scheme should always use same SiteInstance
return false;
if (!IsRendererSandboxed(current_instance->GetProcess()->GetID()))
// non-sandboxed renderers should always create a new SiteInstance
return true;
// Create new a SiteInstance if navigating to a different site.
auto src_url = current_instance->GetSiteURL();
return
!content::SiteInstance::IsSameWebSite(browser_context, src_url, url) &&
// `IsSameWebSite` doesn't seem to work for some URIs such as `file:`,
// handle these scenarios by comparing only the site as defined by
// `GetSiteForURL`.
content::SiteInstance::GetSiteForURL(browser_context, url) != src_url;
}
void AtomBrowserClient::AddSandboxedRendererId(int process_id) {
base::AutoLock auto_lock(sandboxed_renderers_lock_);
sandboxed_renderers_.insert(process_id);
}
void AtomBrowserClient::RemoveSandboxedRendererId(int process_id) {
base::AutoLock auto_lock(sandboxed_renderers_lock_);
sandboxed_renderers_.erase(process_id);
}
bool AtomBrowserClient::IsRendererSandboxed(int process_id) {
base::AutoLock auto_lock(sandboxed_renderers_lock_);
return sandboxed_renderers_.count(process_id);
}
void AtomBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) {
int process_id = host->GetID();
@@ -92,6 +145,13 @@ void AtomBrowserClient::RenderProcessWillLaunch(
host->AddFilter(new TtsMessageFilter(process_id, host->GetBrowserContext()));
host->AddFilter(
new WidevineCdmMessageFilter(process_id, host->GetBrowserContext()));
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
if (WebContentsPreferences::IsSandboxed(web_contents)) {
AddSandboxedRendererId(host->GetID());
// ensure the sandboxed renderer id is removed later
host->AddObserver(this);
}
}
content::SpeechRecognitionManagerDelegate*
@@ -99,8 +159,9 @@ content::SpeechRecognitionManagerDelegate*
return new AtomSpeechRecognitionManagerDelegate;
}
content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() {
return new AtomAccessTokenStore;
content::GeolocationDelegate*
AtomBrowserClient::CreateGeolocationDelegate() {
return new AtomGeolocationDelegate();
}
void AtomBrowserClient::OverrideWebkitPrefs(
@@ -140,8 +201,7 @@ void AtomBrowserClient::OverrideSiteInstanceForNavigation(
return;
}
// Restart renderer process for all navigations except "javacript:" scheme.
if (url.SchemeIs(url::kJavaScriptScheme))
if (!ShouldCreateNewSiteInstance(browser_context, current_instance, url))
return;
scoped_refptr<content::SiteInstance> site_instance =
@@ -173,6 +233,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
// Copy following switches to child process.
static const char* const kCommonSwitchNames[] = {
switches::kStandardSchemes,
switches::kEnableSandbox
};
command_line->CopySwitchesFrom(
*base::CommandLine::ForCurrentProcess(),
@@ -257,6 +318,7 @@ bool AtomBrowserClient::CanCreateWindow(
const content::Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const std::vector<base::string16>& additional_features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
@@ -266,6 +328,11 @@ bool AtomBrowserClient::CanCreateWindow(
bool* no_javascript_access) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (IsRendererSandboxed(render_process_id)) {
*no_javascript_access = false;
return true;
}
if (delegate_) {
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(&api::App::OnCreateWindow,
@@ -273,6 +340,7 @@ bool AtomBrowserClient::CanCreateWindow(
target_url,
frame_name,
disposition,
additional_features,
render_process_id,
opener_render_frame_id));
}
@@ -287,6 +355,7 @@ void AtomBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
additional_schemes->insert(additional_schemes->end(),
schemes_list.begin(),
schemes_list.end());
additional_schemes->push_back(content::kChromeDevToolsScheme);
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
@@ -323,6 +392,7 @@ void AtomBrowserClient::RenderProcessHostDestroyed(
break;
}
}
RemoveSandboxedRendererId(process_id);
}
} // namespace atom

View File

@@ -6,6 +6,7 @@
#define ATOM_BROWSER_ATOM_BROWSER_CLIENT_H_
#include <map>
#include <set>
#include <string>
#include <vector>
@@ -49,7 +50,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
content::AccessTokenStore* CreateAccessTokenStore() override;
content::GeolocationDelegate* CreateGeolocationDelegate() override;
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
content::WebPreferences* prefs) override;
std::string GetApplicationLocale() override;
@@ -87,6 +88,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
const content::Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const std::vector<base::string16>& additional_features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
@@ -108,8 +110,19 @@ class AtomBrowserClient : public brightray::BrowserClient,
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
private:
bool ShouldCreateNewSiteInstance(content::BrowserContext* browser_context,
content::SiteInstance* current_instance,
const GURL& dest_url);
// Add/remove a process id to `sandboxed_renderers_`.
void AddSandboxedRendererId(int process_id);
void RemoveSandboxedRendererId(int process_id);
bool IsRendererSandboxed(int process_id);
// pending_render_process => current_render_process.
std::map<int, int> pending_processes_;
// Set that contains the process ids of all sandboxed renderers
std::set<int> sandboxed_renderers_;
base::Lock sandboxed_renderers_lock_;
std::unique_ptr<AtomResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;

View File

@@ -5,6 +5,7 @@
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/api/atom_api_protocol.h"
#include "atom/browser/atom_blob_reader.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_download_manager_delegate.h"
#include "atom/browser/atom_permission_manager.h"
@@ -30,7 +31,9 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "net/ftp/ftp_network_layer.h"
@@ -68,7 +71,8 @@ AtomBrowserContext::AtomBrowserContext(
const std::string& partition, bool in_memory,
const base::DictionaryValue& options)
: brightray::BrowserContext(partition, in_memory),
network_delegate_(new AtomNetworkDelegate) {
network_delegate_(new AtomNetworkDelegate),
cookie_delegate_(new AtomCookieDelegate) {
// Construct user agent string.
Browser* browser = Browser::Get();
std::string name = RemoveWhitespace(browser->GetName());
@@ -104,6 +108,10 @@ net::NetworkDelegate* AtomBrowserContext::CreateNetworkDelegate() {
return network_delegate_;
}
net::CookieMonsterDelegate* AtomBrowserContext::CreateCookieDelegate() {
return cookie_delegate();
}
std::string AtomBrowserContext::GetUserAgent() {
return user_agent_;
}
@@ -207,6 +215,19 @@ void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
pref_registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
}
AtomBlobReader* AtomBrowserContext::GetBlobReader() {
if (!blob_reader_.get()) {
content::ChromeBlobStorageContext* blob_context =
content::ChromeBlobStorageContext::GetFor(this);
storage::FileSystemContext* file_system_context =
content::BrowserContext::GetStoragePartition(
this, nullptr)->GetFileSystemContext();
blob_reader_.reset(new AtomBlobReader(blob_context,
file_system_context));
}
return blob_reader_.get();
}
// static
scoped_refptr<AtomBrowserContext> AtomBrowserContext::From(
const std::string& partition, bool in_memory,

View File

@@ -8,10 +8,13 @@
#include <string>
#include <vector>
#include "atom/browser/net/atom_cookie_delegate.h"
#include "brightray/browser/browser_context.h"
#include "net/cookies/cookie_monster.h"
namespace atom {
class AtomBlobReader;
class AtomDownloadManagerDelegate;
class AtomNetworkDelegate;
class AtomPermissionManager;
@@ -30,6 +33,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
// brightray::URLRequestContextGetter::Delegate:
net::NetworkDelegate* CreateNetworkDelegate() override;
net::CookieMonsterDelegate* CreateCookieDelegate() override;
std::string GetUserAgent() override;
std::unique_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers) override;
@@ -47,7 +51,11 @@ class AtomBrowserContext : public brightray::BrowserContext {
// brightray::BrowserContext:
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
AtomBlobReader* GetBlobReader();
AtomNetworkDelegate* network_delegate() const { return network_delegate_; }
AtomCookieDelegate* cookie_delegate() const {
return cookie_delegate_.get();
}
protected:
AtomBrowserContext(const std::string& partition, bool in_memory,
@@ -58,11 +66,13 @@ class AtomBrowserContext : public brightray::BrowserContext {
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
std::unique_ptr<WebViewManager> guest_manager_;
std::unique_ptr<AtomPermissionManager> permission_manager_;
std::unique_ptr<AtomBlobReader> blob_reader_;
std::string user_agent_;
bool use_cache_;
// Managed by brightray::BrowserContext.
AtomNetworkDelegate* network_delegate_;
scoped_refptr<AtomCookieDelegate> cookie_delegate_;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
};

View File

@@ -117,7 +117,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
if (node_debugger_->IsRunning())
env->AssignToContext(v8::Debug::GetDebugContext());
// Add atom-shell extended APIs.
// Add Electron extended APIs.
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
// Load everything.

View File

@@ -60,7 +60,7 @@ void AtomDownloadManagerDelegate::CreateDownloadPath(
std::string(),
suggested_filename,
mime_type,
std::string());
"download");
if (!base::PathExists(default_download_path))
base::CreateDirectory(default_download_path);

View File

@@ -10,8 +10,17 @@
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/escape.h"
#include "net/ssl/client_cert_store.h"
#include "url/gurl.h"
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#elif defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#endif
using content::BrowserThread;
namespace atom {
@@ -59,7 +68,8 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool is_main_frame,
ui::PageTransition transition,
bool has_user_gesture) {
bool has_user_gesture,
content::ResourceContext* resource_context) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&HandleExternalProtocolInUI,
url,
@@ -75,4 +85,19 @@ AtomResourceDispatcherHostDelegate::CreateLoginDelegate(
return new LoginHandler(auth_info, request);
}
std::unique_ptr<net::ClientCertStore>
AtomResourceDispatcherHostDelegate::CreateClientCertStore(
content::ResourceContext* resource_context) {
#if defined(USE_NSS_CERTS)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif defined(OS_MACOSX)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
#endif
}
} // namespace atom

View File

@@ -21,10 +21,13 @@ class AtomResourceDispatcherHostDelegate
const content::ResourceRequestInfo::WebContentsGetter&,
bool is_main_frame,
ui::PageTransition transition,
bool has_user_gesture) override;
bool has_user_gesture,
content::ResourceContext* resource_context) override;
content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
net::URLRequest* request) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
};
} // namespace atom

View File

@@ -27,7 +27,7 @@ bool BridgeTaskRunner::PostDelayedTask(
base::TimeDelta delay) {
auto message_loop = base::MessageLoop::current();
if (!message_loop) {
tasks_.push_back(base::MakeTuple(from_here, task, delay));
tasks_.push_back(std::make_tuple(from_here, task, delay));
return true;
}
@@ -48,7 +48,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
base::TimeDelta delay) {
auto message_loop = base::MessageLoop::current();
if (!message_loop) {
non_nestable_tasks_.push_back(base::MakeTuple(from_here, task, delay));
non_nestable_tasks_.push_back(std::make_tuple(from_here, task, delay));
return true;
}

View File

@@ -5,6 +5,7 @@
#ifndef ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
#define ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
#include <tuple>
#include <vector>
#include "base/single_thread_task_runner.h"
@@ -33,7 +34,7 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
base::TimeDelta delay) override;
private:
using TaskPair = base::Tuple<
using TaskPair = std::tuple<
tracked_objects::Location, base::Closure, base::TimeDelta>;
std::vector<TaskPair> tasks_;
std::vector<TaskPair> non_nestable_tasks_;

View File

@@ -14,6 +14,7 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "native_mate/arguments.h"
#if defined(OS_WIN)
@@ -21,7 +22,6 @@
#endif
namespace base {
class DictionaryValue;
class FilePath;
}
@@ -60,7 +60,7 @@ class Browser : public WindowListObserver {
// Overrides the application version.
void SetVersion(const std::string& version);
// Returns the application's name, default is just Atom-Shell.
// Returns the application's name, default is just Electron.
std::string GetName() const;
// Overrides the application name.
@@ -146,6 +146,9 @@ class Browser : public WindowListObserver {
// Set docks' icon.
void DockSetIcon(const gfx::Image& image);
void ShowAboutPanel();
void SetAboutPanelOptions(const base::DictionaryValue& options);
#endif // defined(OS_MACOSX)
#if defined(OS_WIN)
@@ -245,6 +248,10 @@ class Browser : public WindowListObserver {
base::string16 app_user_model_id_;
#endif
#if defined(OS_MACOSX)
base::DictionaryValue about_panel_options_;
#endif
DISALLOW_COPY_AND_ASSIGN(Browser);
};

View File

@@ -253,4 +253,26 @@ void Browser::DockSetIcon(const gfx::Image& image) {
setApplicationIconImage:image.AsNSImage()];
}
void Browser::ShowAboutPanel() {
NSDictionary* options = DictionaryValueToNSDictionary(about_panel_options_);
[[AtomApplication sharedApplication]
orderFrontStandardAboutPanelWithOptions:options];
}
void Browser::SetAboutPanelOptions(const base::DictionaryValue& options) {
about_panel_options_.Clear();
// Upper case option keys for orderFrontStandardAboutPanelWithOptions format
for (base::DictionaryValue::Iterator iter(options);
!iter.IsAtEnd();
iter.Advance()) {
std::string key = iter.key();
std::string value;
if (!key.empty() && iter.value().GetAsString(&value)) {
key[0] = base::ToUpperASCII(key[0]);
about_panel_options_.SetString(key, value);
}
}
}
} // namespace atom

View File

@@ -252,11 +252,11 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser(
}
void CommonWebContentsDelegate::RunFileChooser(
content::WebContents* guest,
content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) {
if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(owner_window()));
web_dialog_helper_->RunFileChooser(guest, params);
web_dialog_helper_->RunFileChooser(render_frame_host, params);
}
void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest,

View File

@@ -71,7 +71,7 @@ class CommonWebContentsDelegate
content::WebContents* web_contents,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) override;
void RunFileChooser(content::WebContents* web_contents,
void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) override;
void EnumerateDirectory(content::WebContents* web_contents,
int request_id,

View File

@@ -87,4 +87,8 @@
atom::Browser::Get()->OnAccessibilitySupportChanged();
}
- (void)orderFrontStandardAboutPanel:(id)sender {
atom::Browser::Get()->ShowAboutPanel();
}
@end

View File

@@ -10,6 +10,10 @@
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
@interface NSWindow (SierraSDK)
@property(class) BOOL allowsAutomaticWindowTabbing;
@end
@implementation AtomApplicationDelegate
- (void)setApplicationDockMenu:(atom::AtomMenuModel*)model {
@@ -21,6 +25,10 @@
// Don't add the "Enter Full Screen" menu item automatically.
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
// Don't add the "Show Tab Bar" menu item.
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
NSWindow.allowsAutomaticWindowTabbing = NO;
atom::Browser::Get()->WillFinishLaunching();
}

View File

@@ -33,6 +33,7 @@
#include "content/public/common/content_switches.h"
#include "ipc/ipc_message_macros.h"
#include "native_mate/dictionary.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
@@ -390,6 +391,10 @@ void NativeWindow::RequestToClosePage() {
if (window_unresposive_closure_.IsCancelled())
ScheduleUnresponsiveEvent(5000);
if (!web_contents())
// Already closed by renderer
return;
if (web_contents()->NeedToFireBeforeUnload())
web_contents()->DispatchBeforeUnload();
else
@@ -503,6 +508,11 @@ void NativeWindow::NotifyWindowScrollTouchEnd() {
OnWindowScrollTouchEnd());
}
void NativeWindow::NotifyWindowScrollTouchEdge() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowScrollTouchEdge());
}
void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowSwipe(direction));

View File

@@ -118,7 +118,8 @@ class NativeWindow : public base::SupportsUserData,
virtual bool IsFullScreenable() = 0;
virtual void SetClosable(bool closable) = 0;
virtual bool IsClosable() = 0;
virtual void SetAlwaysOnTop(bool top) = 0;
virtual void SetAlwaysOnTop(bool top,
const std::string& level = "floating") = 0;
virtual bool IsAlwaysOnTop() = 0;
virtual void Center() = 0;
virtual void SetTitle(const std::string& title) = 0;
@@ -207,6 +208,7 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowMoved();
void NotifyWindowScrollTouchBegin();
void NotifyWindowScrollTouchEnd();
void NotifyWindowScrollTouchEdge();
void NotifyWindowSwipe(const std::string& direction);
void NotifyWindowEnterFullScreen();
void NotifyWindowLeaveFullScreen();

View File

@@ -64,7 +64,7 @@ class NativeWindowMac : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top) override;
void SetAlwaysOnTop(bool top, const std::string& level) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;
@@ -160,9 +160,6 @@ class NativeWindowMac : public NativeWindow,
// The "titleBarStyle" option.
TitleBarStyle title_bar_style_;
// Whether user has scrolled the page to edge.
bool is_edge_;
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);
};

View File

@@ -22,6 +22,7 @@
#include "content/public/browser/render_widget_host_view.h"
#include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skia_util.h"
namespace {
@@ -529,8 +530,7 @@ NativeWindowMac::NativeWindowMac(
: NativeWindow(web_contents, options, parent),
is_kiosk_(false),
attention_request_id_(0),
title_bar_style_(NORMAL),
is_edge_(false) {
title_bar_style_(NORMAL) {
int width = 800, height = 600;
options.Get(options::kWidth, &width);
options.Get(options::kHeight, &height);
@@ -675,16 +675,14 @@ NativeWindowMac::NativeWindowMac(
if (!web_contents)
return event;
if (!began && is_edge_ && (([event phase] == NSEventPhaseMayBegin) ||
if (!began && (([event phase] == NSEventPhaseMayBegin) ||
([event phase] == NSEventPhaseBegan))) {
this->NotifyWindowScrollTouchBegin();
began = YES;
is_edge_ = false;
} else if (began && (([event phase] == NSEventPhaseEnded) ||
([event phase] == NSEventPhaseCancelled))) {
this->NotifyWindowScrollTouchEnd();
began = NO;
is_edge_ = false;
}
return event;
}];
@@ -742,8 +740,9 @@ bool NativeWindowMac::IsFocused() {
void NativeWindowMac::Show() {
if (is_modal() && parent()) {
[parent()->GetNativeWindow() beginSheet:window_
completionHandler:^(NSModalResponse) {}];
if ([window_ sheetParent] == nil)
[parent()->GetNativeWindow() beginSheet:window_
completionHandler:^(NSModalResponse) {}];
return;
}
@@ -945,12 +944,32 @@ bool NativeWindowMac::IsClosable() {
return [window_ styleMask] & NSClosableWindowMask;
}
void NativeWindowMac::SetAlwaysOnTop(bool top) {
[window_ setLevel:(top ? NSFloatingWindowLevel : NSNormalWindowLevel)];
void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
int windowLevel = NSNormalWindowLevel;
if (top) {
if (level == "floating") {
windowLevel = NSFloatingWindowLevel;
} else if (level == "torn-off-menu") {
windowLevel = NSTornOffMenuWindowLevel;
} else if (level == "modal-panel") {
windowLevel = NSModalPanelWindowLevel;
} else if (level == "main-menu") {
windowLevel = NSMainMenuWindowLevel;
} else if (level == "status") {
windowLevel = NSStatusWindowLevel;
} else if (level == "pop-up-menu") {
windowLevel = NSPopUpMenuWindowLevel;
} else if (level == "screen-saver") {
windowLevel = NSScreenSaverWindowLevel;
} else if (level == "dock") {
windowLevel = NSDockWindowLevel;
}
}
[window_ setLevel:windowLevel];
}
bool NativeWindowMac::IsAlwaysOnTop() {
return [window_ level] == NSFloatingWindowLevel;
return [window_ level] != NSNormalWindowLevel;
}
void NativeWindowMac::Center() {
@@ -1009,8 +1028,8 @@ bool NativeWindowMac::IsKiosk() {
void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
SkColor color = ParseHexColor(color_name);
base::ScopedCFTypeRef<CGColorRef> cgcolor =
skia::CGColorCreateFromSkColor(color);
base::ScopedCFTypeRef<CGColorRef> cgcolor(
skia::CGColorCreateFromSkColor(color));
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
const auto view = web_contents()->GetRenderWidgetHostView();
@@ -1130,7 +1149,7 @@ void NativeWindowMac::OnInputEvent(const blink::WebInputEvent& event) {
case blink::WebInputEvent::GestureScrollBegin:
case blink::WebInputEvent::GestureScrollUpdate:
case blink::WebInputEvent::GestureScrollEnd:
is_edge_ = true;
this->NotifyWindowScrollTouchEdge();
break;
default:
break;

View File

@@ -64,6 +64,7 @@ class NativeWindowObserver {
virtual void OnWindowMoved() {}
virtual void OnWindowScrollTouchBegin() {}
virtual void OnWindowScrollTouchEnd() {}
virtual void OnWindowScrollTouchEdge() {}
virtual void OnWindowSwipe(const std::string& direction) {}
virtual void OnWindowEnterFullScreen() {}
virtual void OnWindowLeaveFullScreen() {}

View File

@@ -138,7 +138,7 @@ NativeWindowViews::NativeWindowViews(
menu_bar_visible_(false),
menu_bar_alt_pressed_(false),
#if defined(OS_WIN)
enabled_a11y_support_(false),
checked_for_a11y_support_(false),
thick_frame_(true),
#endif
keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
@@ -682,7 +682,7 @@ bool NativeWindowViews::IsClosable() {
#endif
}
void NativeWindowViews::SetAlwaysOnTop(bool top) {
void NativeWindowViews::SetAlwaysOnTop(bool top, const std::string& level) {
window_->SetAlwaysOnTop(top);
}

View File

@@ -18,6 +18,8 @@
#include "atom/browser/ui/win/message_handler_delegate.h"
#include "atom/browser/ui/win/taskbar_host.h"
#include "base/win/scoped_gdi_object.h"
#include "ui/base/win/accessibility_misc_utils.h"
#include <UIAutomationCoreApi.h>
#endif
namespace views {
@@ -84,7 +86,7 @@ class NativeWindowViews : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top) override;
void SetAlwaysOnTop(bool top, const std::string& level) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;
@@ -228,8 +230,8 @@ class NativeWindowViews : public NativeWindow,
// In charge of running taskbar related APIs.
TaskbarHost taskbar_host_;
// If true we have enabled a11y
bool enabled_a11y_support_;
// Memoized version of a11y check
bool checked_for_a11y_support_;
// Whether to show the WS_THICKFRAME style.
bool thick_frame_;

View File

@@ -72,6 +72,12 @@ const char* AppCommandToString(int command_id) {
}
}
bool IsScreenReaderActive() {
UINT screenReader = 0;
SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
return screenReader && UiaClientsAreListening();
}
} // namespace
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
@@ -91,16 +97,24 @@ bool NativeWindowViews::PreHandleMSG(
// because we still want Chromium to handle returning the actual
// accessibility object.
case WM_GETOBJECT: {
const DWORD obj_id = static_cast<DWORD>(l_param);
if (enabled_a11y_support_) return false;
if (checked_for_a11y_support_) return false;
if (obj_id == OBJID_CLIENT) {
const auto axState = content::BrowserAccessibilityState::GetInstance();
if (axState && !axState->IsAccessibleBrowser()) {
axState->OnScreenReaderDetected();
enabled_a11y_support_ = true;
Browser::Get()->OnAccessibilitySupportChanged();
}
const DWORD obj_id = static_cast<DWORD>(l_param);
if (obj_id != OBJID_CLIENT) {
return false;
}
if (!IsScreenReaderActive()) {
return false;
}
checked_for_a11y_support_ = true;
const auto axState = content::BrowserAccessibilityState::GetInstance();
if (axState && !axState->IsAccessibleBrowser()) {
axState->OnScreenReaderDetected();
Browser::Get()->OnAccessibilitySupportChanged();
}
return false;

View File

@@ -40,10 +40,7 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
}
int AtomCertVerifier::Verify(
net::X509Certificate* cert,
const std::string& hostname,
const std::string& ocsp_response,
int flags,
const RequestParams& params,
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback,
@@ -53,12 +50,11 @@ int AtomCertVerifier::Verify(
if (verify_proc_.is_null())
return default_cert_verifier_->Verify(
cert, hostname, ocsp_response, flags, crl_set, verify_result, callback,
out_req, net_log);
params, crl_set, verify_result, callback, out_req, net_log);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(verify_proc_, hostname, make_scoped_refptr(cert),
base::Bind(verify_proc_, params.hostname(), params.certificate(),
base::Bind(OnResult, verify_result, callback)));
return net::ERR_IO_PENDING;
}

View File

@@ -26,10 +26,7 @@ class AtomCertVerifier : public net::CertVerifier {
protected:
// net::CertVerifier:
int Verify(net::X509Certificate* cert,
const std::string& hostname,
const std::string& ocsp_response,
int flags,
int Verify(const RequestParams& params,
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback,

View File

@@ -0,0 +1,41 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/net/atom_cookie_delegate.h"
#include "content/public/browser/browser_thread.h"
namespace atom {
AtomCookieDelegate::AtomCookieDelegate() {
}
AtomCookieDelegate::~AtomCookieDelegate() {
}
void AtomCookieDelegate::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
void AtomCookieDelegate::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
void AtomCookieDelegate::NotifyObservers(
const net::CanonicalCookie& cookie, bool removed, ChangeCause cause) {
FOR_EACH_OBSERVER(Observer,
observers_,
OnCookieChanged(cookie, removed, cause));
}
void AtomCookieDelegate::OnCookieChanged(
const net::CanonicalCookie& cookie, bool removed, ChangeCause cause) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(&AtomCookieDelegate::NotifyObservers,
this, cookie, removed, cause));
}
} // namespace atom

View File

@@ -0,0 +1,48 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_NET_ATOM_COOKIE_DELEGATE_H_
#define ATOM_BROWSER_NET_ATOM_COOKIE_DELEGATE_H_
#include "base/observer_list.h"
#include "net/cookies/cookie_monster.h"
namespace atom {
class AtomCookieDelegate : public net::CookieMonsterDelegate {
public:
AtomCookieDelegate();
~AtomCookieDelegate() override;
class Observer {
public:
virtual void OnCookieChanged(const net::CanonicalCookie& cookie,
bool removed,
ChangeCause cause) {}
protected:
virtual ~Observer() {}
};
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
// net::CookieMonsterDelegate:
void OnCookieChanged(const net::CanonicalCookie& cookie,
bool removed,
ChangeCause cause) override;
private:
base::ObserverList<Observer> observers_;
void NotifyObservers(const net::CanonicalCookie& cookie,
bool removed,
ChangeCause cause);
DISALLOW_COPY_AND_ASSIGN(AtomCookieDelegate);
};
} // namespace atom
#endif // ATOM_BROWSER_NET_ATOM_COOKIE_DELEGATE_H_

View File

@@ -239,7 +239,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url);
}
int AtomNetworkDelegate::OnBeforeSendHeaders(
int AtomNetworkDelegate::OnBeforeStartTransaction(
net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) {
@@ -254,18 +254,18 @@ int AtomNetworkDelegate::OnBeforeSendHeaders(
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
client_id);
if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders))
return brightray::NetworkDelegate::OnBeforeSendHeaders(
return brightray::NetworkDelegate::OnBeforeStartTransaction(
request, callback, headers);
return HandleResponseEvent(
kOnBeforeSendHeaders, request, callback, headers, *headers);
}
void AtomNetworkDelegate::OnSendHeaders(
void AtomNetworkDelegate::OnStartTransaction(
net::URLRequest* request,
const net::HttpRequestHeaders& headers) {
if (!ContainsKey(simple_listeners_, kOnSendHeaders)) {
brightray::NetworkDelegate::OnSendHeaders(request, headers);
brightray::NetworkDelegate::OnStartTransaction(request, headers);
return;
}

View File

@@ -77,11 +77,11 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
int OnBeforeURLRequest(net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) override;
int OnBeforeSendHeaders(net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) override;
void OnSendHeaders(net::URLRequest* request,
const net::HttpRequestHeaders& headers) override;
int OnBeforeStartTransaction(net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) override;
void OnStartTransaction(net::URLRequest* request,
const net::HttpRequestHeaders& headers) override;
int OnHeadersReceived(
net::URLRequest* request,
const net::CompletionCallback& callback,

View File

@@ -71,8 +71,9 @@ class AtomCopyFrameGenerator {
content::BrowserThread::PostDelayedTask(content::BrowserThread::UI,
FROM_HERE,
base::Bind(&AtomCopyFrameGenerator::InternalGenerateCopyFrame,
weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(
frame_rate_threshold_ms_ - frame_rate_delta));
weak_ptr_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(
frame_rate_threshold_ms_ - frame_rate_delta));
return;
}
@@ -103,9 +104,7 @@ class AtomCopyFrameGenerator {
damage_rect));
request->set_area(gfx::Rect(view_->GetPhysicalBackingSize()));
view_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(
std::move(request));
view_->GetRootLayer()->RequestCopyOfOutput(std::move(request));
}
void CopyFromCompositingSurfaceHasResult(
@@ -302,10 +301,9 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
AtomBeginFrameTimer(int frame_rate_threshold_ms,
const base::Closure& callback)
: callback_(callback) {
time_source_ = cc::DelayBasedTimeSource::Create(
base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms),
time_source_.reset(new cc::DelayBasedTimeSource(
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI).get());
content::BrowserThread::UI).get()));
time_source_->SetClient(this);
}
@@ -351,12 +349,17 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
is_showing_(!render_widget_host_->is_hidden()),
size_(native_window->GetSize()),
painting_(true),
root_layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)),
#if !defined(OS_MACOSX)
delegated_frame_host_(new content::DelegatedFrameHost(this)),
#endif
weak_ptr_factory_(this) {
DCHECK(render_widget_host_);
render_widget_host_->SetView(this);
#if !defined(OS_MACOSX)
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
#endif
#if defined(OS_MACOSX)
CreatePlatformWidget();
#else
@@ -364,17 +367,29 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
new ui::Compositor(content::GetContextFactory(),
base::ThreadTaskRunnerHandle::Get()));
compositor_->SetAcceleratedWidget(native_window_->GetAcceleratedWidget());
#endif
compositor_->SetDelegate(this);
compositor_->SetRootLayer(root_layer_.get());
#endif
GetCompositor()->SetDelegate(this);
native_window_->AddObserver(this);
ResizeRootLayer();
}
OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
if (native_window_)
native_window_->RemoveObserver(this);
#if defined(OS_MACOSX)
if (is_showing_)
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
// Marking the DelegatedFrameHost as removed from the window hierarchy is
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_)
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor();
#endif
#if defined(OS_MACOSX)
DestroyPlatformWidget();
@@ -429,11 +444,10 @@ content::RenderWidgetHost* OffScreenRenderWidgetHostView::GetRenderWidgetHost()
void OffScreenRenderWidgetHostView::SetSize(const gfx::Size& size) {
size_ = size;
const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(scale_factor_, size);
root_layer_->SetBounds(gfx::Rect(size));
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels);
ResizeRootLayer();
if (render_widget_host_)
render_widget_host_->WasResized();
GetDelegatedFrameHost()->WasResized();
}
void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
@@ -464,7 +478,7 @@ bool OffScreenRenderWidgetHostView::HasFocus() const {
}
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
return delegated_frame_host_->CanCopyToBitmap();
return GetDelegatedFrameHost()->CanCopyToBitmap();
}
void OffScreenRenderWidgetHostView::Show() {
@@ -472,10 +486,16 @@ void OffScreenRenderWidgetHostView::Show() {
return;
is_showing_ = true;
if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo());
#if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->WasShown(ui::LatencyInfo());
#endif
if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo());
}
void OffScreenRenderWidgetHostView::Hide() {
@@ -484,8 +504,14 @@ void OffScreenRenderWidgetHostView::Hide() {
if (render_widget_host_)
render_widget_host_->WasHidden();
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor();
#if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->ResetCompositor();
#endif
is_showing_ = false;
}
@@ -522,52 +548,63 @@ bool OffScreenRenderWidgetHostView::LockMouse() {
void OffScreenRenderWidgetHostView::UnlockMouse() {
}
bool OffScreenRenderWidgetHostView::GetScreenColorProfile(std::vector<char>*) {
return false;
}
void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
uint32_t output_surface_id,
std::unique_ptr<cc::CompositorFrame> frame) {
cc::CompositorFrame frame) {
TRACE_EVENT0("electron",
"OffScreenRenderWidgetHostView::OnSwapCompositorFrame");
if (frame->metadata.root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = frame->metadata.root_scroll_offset;
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = frame.metadata.root_scroll_offset;
}
if (frame->delegated_frame_data) {
if (frame.delegated_frame_data) {
if (software_output_device_) {
if (!begin_frame_timer_.get()) {
software_output_device_->SetActive(painting_);
}
// The compositor will draw directly to the SoftwareOutputDevice which
// then calls OnPaint.
#if defined(OS_MACOSX)
browser_compositor_->SwapCompositorFrame(output_surface_id,
std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
std::move(frame));
#endif
} else {
if (!copy_frame_generator_.get()) {
copy_frame_generator_.reset(
new AtomCopyFrameGenerator(frame_rate_threshold_ms_, this));
}
// Determine the damage rectangle for the current frame. This is the same
// calculation that SwapDelegatedFrame uses.
cc::RenderPass* root_pass =
frame->delegated_frame_data->render_pass_list.back().get();
frame.delegated_frame_data->render_pass_list.back().get();
gfx::Size frame_size = root_pass->output_rect.size();
gfx::Rect damage_rect =
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
damage_rect.Intersect(gfx::Rect(frame_size));
#if defined(OS_MACOSX)
browser_compositor_->SwapCompositorFrame(output_surface_id,
std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
std::move(frame));
#endif
if (painting_)
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
// Request a copy of the last compositor frame which will eventually call
// OnPaint asynchronously.
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
}
}
}
void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
delegated_frame_host_->ClearDelegatedFrame();
GetDelegatedFrameHost()->ClearDelegatedFrame();
}
void OffScreenRenderWidgetHostView::InitAsPopup(
@@ -612,7 +649,7 @@ void OffScreenRenderWidgetHostView::CopyFromCompositingSurface(
const gfx::Size& dst_size,
const content::ReadbackRequestCallback& callback,
const SkColorType preferred_color_type) {
delegated_frame_host_->CopyFromCompositingSurface(
GetDelegatedFrameHost()->CopyFromCompositingSurface(
src_subrect, dst_size, callback, preferred_color_type);
}
@@ -620,21 +657,21 @@ void OffScreenRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame(
const gfx::Rect& src_subrect,
const scoped_refptr<media::VideoFrame>& target,
const base::Callback<void(const gfx::Rect&, bool)>& callback) {
delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame(
GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
src_subrect, target, callback);
}
bool OffScreenRenderWidgetHostView::CanCopyToVideoFrame() const {
return delegated_frame_host_->CanCopyToVideoFrame();
return GetDelegatedFrameHost()->CanCopyToVideoFrame();
}
void OffScreenRenderWidgetHostView::BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
delegated_frame_host_->BeginFrameSubscription(std::move(subscriber));
GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
}
void OffScreenRenderWidgetHostView::EndFrameSubscription() {
delegated_frame_host_->EndFrameSubscription();
GetDelegatedFrameHost()->EndFrameSubscription();
}
bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) {
@@ -749,7 +786,7 @@ void OffScreenRenderWidgetHostView::SetBeginFrameSource(
std::unique_ptr<cc::SoftwareOutputDevice>
OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
ui::Compositor* compositor) {
DCHECK_EQ(compositor_.get(), compositor);
DCHECK_EQ(GetCompositor(), compositor);
DCHECK(!copy_frame_generator_);
DCHECK(!software_output_device_);
@@ -763,7 +800,11 @@ std::unique_ptr<cc::SoftwareOutputDevice>
bool OffScreenRenderWidgetHostView::InstallTransparency() {
if (transparent_) {
SetBackgroundColor(SkColor());
#if defined(OS_MACOSX)
browser_compositor_->SetHasTransparentBackground(true);
#else
compositor_->SetHostHasTransparentBackground(true);
#endif
return true;
}
return false;
@@ -816,13 +857,28 @@ int OffScreenRenderWidgetHostView::GetFrameRate() const {
return frame_rate_;
}
#if !defined(OS_MACOSX)
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() const {
return compositor_.get();
}
ui::Layer* OffScreenRenderWidgetHostView::GetRootLayer() const {
return root_layer_.get();
}
content::DelegatedFrameHost*
OffScreenRenderWidgetHostView::GetDelegatedFrameHost() const {
return delegated_frame_host_.get();
}
#endif
void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
if (!force && frame_rate_threshold_ms_ != 0)
return;
frame_rate_threshold_ms_ = 1000 / frame_rate_;
compositor_->vsync_manager()->SetAuthoritativeVSyncInterval(
GetCompositor()->vsync_manager()->SetAuthoritativeVSyncInterval(
base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms_));
if (copy_frame_generator_.get()) {
@@ -840,6 +896,16 @@ void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
}
}
void OffScreenRenderWidgetHostView::Invalidate() {
const gfx::Rect& bounds_in_pixels = GetViewBounds();
if (software_output_device_) {
software_output_device_->OnPaint(bounds_in_pixels);
} else if (copy_frame_generator_.get()) {
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
}
}
void OffScreenRenderWidgetHostView::ResizeRootLayer() {
SetupFrameRate(false);
@@ -848,14 +914,25 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer() {
gfx::Size size = GetViewBounds().size();
if (!scaleFactorDidChange && size == root_layer_->bounds().size())
if (!scaleFactorDidChange && size == GetRootLayer()->bounds().size())
return;
const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(scale_factor_, size);
root_layer_->SetBounds(gfx::Rect(size));
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels);
GetRootLayer()->SetBounds(gfx::Rect(size));
GetCompositor()->SetScaleAndSize(scale_factor_, size_in_pixels);
}
void OffScreenRenderWidgetHostView::OnWindowResize() {
// In offscreen mode call RenderWidgetHostView's SetSize explicitly
auto size = native_window_->GetSize();
SetSize(size);
}
void OffScreenRenderWidgetHostView::OnWindowClosed() {
native_window_->RemoveObserver(this);
native_window_ = nullptr;
}
} // namespace atom

View File

@@ -13,6 +13,7 @@
#endif
#include "atom/browser/native_window.h"
#include "atom/browser/native_window_observer.h"
#include "atom/browser/osr/osr_output_device.h"
#include "base/process/kill.h"
#include "base/threading/thread.h"
@@ -36,7 +37,6 @@
#if defined(OS_MACOSX)
#include "content/browser/renderer_host/browser_compositor_view_mac.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#endif
#if defined(OS_MACOSX)
@@ -54,13 +54,15 @@ namespace atom {
class AtomCopyFrameGenerator;
class AtomBeginFrameTimer;
#if defined(OS_MACOSX)
class MacHelper;
#endif
class OffScreenRenderWidgetHostView
: public content::RenderWidgetHostViewBase,
#if defined(OS_MACOSX)
public ui::AcceleratedWidgetMacNSView,
#endif
public ui::CompositorDelegate,
public content::DelegatedFrameHostClient {
public content::DelegatedFrameHostClient,
public NativeWindowObserver {
public:
OffScreenRenderWidgetHostView(bool transparent,
const OnPaintCallback& callback,
@@ -90,7 +92,6 @@ class OffScreenRenderWidgetHostView
void SetBackgroundColor(SkColor color) override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
bool GetScreenColorProfile(std::vector<char>*) override;
#if defined(OS_MACOSX)
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
void SetActive(bool active) override;
@@ -102,7 +103,7 @@ class OffScreenRenderWidgetHostView
#endif // defined(OS_MACOSX)
// content::RenderWidgetHostViewBase:
void OnSwapCompositorFrame(uint32_t, std::unique_ptr<cc::CompositorFrame>)
void OnSwapCompositorFrame(uint32_t, cc::CompositorFrame)
override;
void ClearCompositorFrame(void) override;
void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect)
@@ -173,13 +174,9 @@ class OffScreenRenderWidgetHostView
bool IsAutoResizeEnabled() const;
void OnSetNeedsBeginFrames(bool enabled);
#if defined(OS_MACOSX)
// ui::AcceleratedWidgetMacNSView:
NSView* AcceleratedWidgetGetNSView() const override;
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase, base::TimeDelta* interval) const override;
void AcceleratedWidgetSwapCompleted() override;
#endif // defined(OS_MACOSX)
// NativeWindowObserver:
void OnWindowResize() override;
void OnWindowClosed() override;
void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time,
@@ -198,9 +195,15 @@ class OffScreenRenderWidgetHostView
void SetFrameRate(int frame_rate);
int GetFrameRate() const;
ui::Compositor* compositor() const { return compositor_.get(); }
ui::Compositor* GetCompositor() const;
ui::Layer* GetRootLayer() const;
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
void Invalidate();
content::RenderWidgetHostImpl* render_widget_host() const
{ return render_widget_host_; }
NativeWindow* window() const { return native_window_; }
private:
void SetupFrameRate(bool force);
@@ -233,10 +236,13 @@ class OffScreenRenderWidgetHostView
std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_;
#if defined(OS_MACOSX)
NSWindow* window_;
CALayer* background_layer_;
std::unique_ptr<content::BrowserCompositorMac> browser_compositor_;
// Can not be managed by smart pointer because its header can not be included
// in the file that has the destructor.
MacHelper* mac_helper_;
// Selected text on the renderer.
std::string selected_text_;
#endif

View File

@@ -7,48 +7,115 @@
#import <Cocoa/Cocoa.h>
#include "base/strings/utf_string_conversions.h"
#include "content/common/view_messages.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
namespace atom {
class MacHelper :
public content::BrowserCompositorMacClient,
public ui::AcceleratedWidgetMacNSView {
public:
explicit MacHelper(OffScreenRenderWidgetHostView* view) : view_(view) {}
virtual ~MacHelper() {}
// content::BrowserCompositorMacClient:
NSView* BrowserCompositorMacGetNSView() const override {
// Intentionally return nil so that
// BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP uses the layer
// size instead of the NSView size.
return nil;
}
SkColor BrowserCompositorMacGetGutterColor(SkColor color) const override {
// When making an element on the page fullscreen the element's background
// may not match the page's, so use black as the gutter color to avoid
// flashes of brighter colors during the transition.
if (view_->render_widget_host()->delegate() &&
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
return SK_ColorBLACK;
}
return color;
}
void BrowserCompositorMacSendCompositorSwapAck(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
view_->render_widget_host()->Send(new ViewMsg_SwapCompositorFrameAck(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
}
void BrowserCompositorMacSendReclaimCompositorResources(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
}
void BrowserCompositorMacOnLostCompositorResources() override {
view_->render_widget_host()->ScheduleComposite();
}
void BrowserCompositorMacUpdateVSyncParameters(
const base::TimeTicks& timebase,
const base::TimeDelta& interval) override {
view_->render_widget_host()->UpdateVSyncParameters(timebase, interval);
}
void BrowserCompositorMacSendBeginFrame(
const cc::BeginFrameArgs& args) override {
view_->render_widget_host()->Send(
new ViewMsg_BeginFrame(view_->render_widget_host()->GetRoutingID(),
args));
}
// ui::AcceleratedWidgetMacNSView:
NSView* AcceleratedWidgetGetNSView() const override {
return [view_->window()->GetNativeWindow() contentView];
}
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase, base::TimeDelta* interval) const override {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
}
void AcceleratedWidgetSwapCompleted() override {
}
private:
OffScreenRenderWidgetHostView* view_;
DISALLOW_COPY_AND_ASSIGN(MacHelper);
};
ui::AcceleratedWidgetMac*
atom::OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const {
OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const {
if (browser_compositor_)
return browser_compositor_->accelerated_widget_mac();
return browser_compositor_->GetAcceleratedWidgetMac();
return nullptr;
}
NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() const {
return [native_window_->GetNativeWindow() contentView];
void OffScreenRenderWidgetHostView::SetActive(bool active) {
}
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase, base::TimeDelta* interval) const {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
void OffScreenRenderWidgetHostView::ShowDefinitionForSelection() {
}
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetSwapCompleted() {
}
void atom::OffScreenRenderWidgetHostView::SetActive(bool active) {
}
void atom::OffScreenRenderWidgetHostView::ShowDefinitionForSelection() {
}
bool atom::OffScreenRenderWidgetHostView::SupportsSpeech() const {
bool OffScreenRenderWidgetHostView::SupportsSpeech() const {
return false;
}
void atom::OffScreenRenderWidgetHostView::SpeakSelection() {
void OffScreenRenderWidgetHostView::SpeakSelection() {
}
bool atom::OffScreenRenderWidgetHostView::IsSpeaking() const {
bool OffScreenRenderWidgetHostView::IsSpeaking() const {
return false;
}
void atom::OffScreenRenderWidgetHostView::StopSpeaking() {
void OffScreenRenderWidgetHostView::StopSpeaking() {
}
void atom::OffScreenRenderWidgetHostView::SelectionChanged(
void OffScreenRenderWidgetHostView::SelectionChanged(
const base::string16& text,
size_t offset,
const gfx::Range& range) {
@@ -69,24 +136,28 @@ void atom::OffScreenRenderWidgetHostView::SelectionChanged(
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
}
void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() {
browser_compositor_ = content::BrowserCompositorMac::Create();
compositor_.reset(browser_compositor_->compositor());
compositor_->SetRootLayer(root_layer_.get());
browser_compositor_->accelerated_widget_mac()->SetNSView(this);
browser_compositor_->compositor()->SetVisible(true);
compositor_->SetLocksWillTimeOut(true);
browser_compositor_->Unsuspend();
void OffScreenRenderWidgetHostView::CreatePlatformWidget() {
mac_helper_ = new MacHelper(this);
browser_compositor_.reset(new content::BrowserCompositorMac(
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true));
}
void atom::OffScreenRenderWidgetHostView::DestroyPlatformWidget() {
ui::Compositor* compositor = compositor_.release();
ALLOW_UNUSED_LOCAL(compositor);
browser_compositor_->accelerated_widget_mac()->ResetNSView();
browser_compositor_->compositor()->SetVisible(false);
browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0));
browser_compositor_->compositor()->SetRootLayer(NULL);
void OffScreenRenderWidgetHostView::DestroyPlatformWidget() {
browser_compositor_.reset();
delete mac_helper_;
}
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() const {
return browser_compositor_->GetCompositor();
}
ui::Layer* OffScreenRenderWidgetHostView::GetRootLayer() const {
return browser_compositor_->GetRootLayer();
}
content::DelegatedFrameHost*
OffScreenRenderWidgetHostView::GetDelegatedFrameHost() const {
return browser_compositor_->GetDelegatedFrameHost();
}
} // namespace

View File

@@ -4,6 +4,8 @@
#include "atom/browser/osr/osr_web_contents_view.h"
#import <Cocoa/Cocoa.h>
@interface OffScreenView : NSView
@end

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>1.3.6</string>
<string>1.4.4</string>
<key>CFBundleShortVersionString</key>
<string>1.3.6</string>
<string>1.4.4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

View File

@@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,6,0
PRODUCTVERSION 1,3,6,0
FILEVERSION 1,4,4,0
PRODUCTVERSION 1,4,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "1.3.6"
VALUE "FileVersion", "1.4.4"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "1.3.6"
VALUE "ProductVersion", "1.4.4"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -63,7 +63,9 @@ void MenuBar::SetMenu(AtomMenuModel* model) {
RemoveAllChildViews(true);
for (int i = 0; i < model->GetItemCount(); ++i) {
SubmenuButton* button = new SubmenuButton(this, model->GetLabelAt(i), this);
SubmenuButton* button = new SubmenuButton(model->GetLabelAt(i),
this,
background_color_);
button->set_tag(i);
#if defined(USE_X11)
@@ -131,9 +133,6 @@ const char* MenuBar::GetClassName() const {
return kViewClassName;
}
void MenuBar::ButtonPressed(views::Button* sender, const ui::Event& event) {
}
void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
const gfx::Point& point,
const ui::Event* event) {

View File

@@ -6,7 +6,6 @@
#define ATOM_BROWSER_UI_VIEWS_MENU_BAR_H_
#include "atom/browser/ui/atom_menu_model.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/view.h"
@@ -19,7 +18,6 @@ namespace atom {
class MenuDelegate;
class MenuBar : public views::View,
public views::ButtonListener,
public views::MenuButtonListener {
public:
MenuBar();
@@ -50,9 +48,6 @@ class MenuBar : public views::View,
// views::View:
const char* GetClassName() const override;
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::MenuButtonListener:
void OnMenuButtonClicked(views::MenuButton* source,
const gfx::Point& point,

View File

@@ -7,7 +7,10 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/text_utils.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_host_view.h"
#include "ui/views/controls/button/label_button_border.h"
namespace atom {
@@ -23,9 +26,9 @@ base::string16 FilterAccelerator(const base::string16& label) {
} // namespace
SubmenuButton::SubmenuButton(views::ButtonListener* listener,
const base::string16& title,
views::MenuButtonListener* menu_button_listener)
SubmenuButton::SubmenuButton(const base::string16& title,
views::MenuButtonListener* menu_button_listener,
const SkColor& background_color)
: views::MenuButton(FilterAccelerator(title),
menu_button_listener, false),
accelerator_(0),
@@ -34,7 +37,8 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener,
underline_end_(-1),
text_width_(0),
text_height_(0),
underline_color_(SK_ColorBLACK) {
underline_color_(SK_ColorBLACK),
background_color_(background_color) {
#if defined(OS_LINUX)
// Dont' use native style border.
SetBorder(std::move(CreateDefaultBorder()));
@@ -44,11 +48,45 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener,
&underline_end_))
gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_,
&text_height_, 0, 0);
SetHasInkDrop(true);
set_ink_drop_base_color(
color_utils::BlendTowardOppositeLuma(background_color_, 0x61));
set_request_focus_on_press(true);
SetFocusForPlatform();
SetFocusPainter(nullptr);
}
SubmenuButton::~SubmenuButton() {
}
std::unique_ptr<views::InkDropRipple> SubmenuButton::CreateInkDropRipple()
const {
return base::MakeUnique<views::FloodFillInkDropRipple>(
GetLocalBounds(),
GetInkDropCenterBasedOnLastEvent(),
GetInkDropBaseColor(),
ink_drop_visible_opacity());
}
std::unique_ptr<views::InkDropHighlight>
SubmenuButton::CreateInkDropHighlight() const {
if (!ShouldShowInkDropHighlight())
return nullptr;
gfx::Size size = GetLocalBounds().size();
return base::MakeUnique<views::InkDropHighlight>(
size,
kInkDropSmallCornerRadius,
gfx::RectF(gfx::SizeF(size)).CenterPoint(),
GetInkDropBaseColor());
}
bool SubmenuButton::ShouldShowInkDropForFocus() const {
return false;
}
void SubmenuButton::SetAcceleratorVisibility(bool visible) {
if (visible == show_underline_)
return;

View File

@@ -5,6 +5,7 @@
#ifndef ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
#define ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/controls/button/menu_button.h"
namespace atom {
@@ -12,9 +13,9 @@ namespace atom {
// Special button that used by menu bar to show submenus.
class SubmenuButton : public views::MenuButton {
public:
SubmenuButton(views::ButtonListener* listener,
const base::string16& title,
views::MenuButtonListener* menu_button_listener);
SubmenuButton(const base::string16& title,
views::MenuButtonListener* menu_button_listener,
const SkColor& background_color);
virtual ~SubmenuButton();
void SetAcceleratorVisibility(bool visible);
@@ -28,6 +29,12 @@ class SubmenuButton : public views::MenuButton {
// views::MenuButton:
void OnPaint(gfx::Canvas* canvas) override;
// views::InkDropHostView:
std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
const override;
bool ShouldShowInkDropForFocus() const override;
private:
bool GetUnderlinePosition(const base::string16& text,
base::char16* accelerator,
@@ -44,6 +51,7 @@ class SubmenuButton : public views::MenuButton {
int text_width_;
int text_height_;
SkColor underline_color_;
SkColor background_color_;
DISALLOW_COPY_AND_ASSIGN(SubmenuButton);
};

View File

@@ -97,6 +97,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
command_line->AppendSwitchASCII(switches::kNodeIntegration,
node_integration ? "true" : "false");
// If the `sandbox` option was passed to the BrowserWindow's webPreferences,
// pass `--enable-sandbox` to the renderer so it won't have any node.js
// integration.
if (IsSandboxed(web_contents))
command_line->AppendSwitch(switches::kEnableSandbox);
// The preload script.
base::FilePath::StringType preload;
if (web_preferences.GetString(options::kPreloadScript, &preload)) {
@@ -194,6 +200,21 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
command_line->AppendSwitch(cc::switches::kEnableBeginFrameScheduling);
}
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
WebContentsPreferences* self;
if (!web_contents)
return false;
self = FromWebContents(web_contents);
if (!self)
return false;
base::DictionaryValue& web_preferences = self->web_preferences_;
bool sandboxed = false;
web_preferences.GetBoolean("sandbox", &sandboxed);
return sandboxed;
}
// static
void WebContentsPreferences::OverrideWebkitPrefs(
content::WebContents* web_contents, content::WebPreferences* prefs) {

View File

@@ -36,6 +36,8 @@ class WebContentsPreferences
static void AppendExtraCommandLineSwitches(
content::WebContents* web_contents, base::CommandLine* command_line);
static bool IsSandboxed(content::WebContents* web_contents);
// Modify the WebPreferences according to |web_contents|'s preferences.
static void OverrideWebkitPrefs(
content::WebContents* web_contents, content::WebPreferences* prefs);

View File

@@ -16,9 +16,11 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/file_chooser_file_info.h"
#include "content/public/common/file_chooser_params.h"
#include "net/base/mime_util.h"
#include "ui/shell_dialogs/selected_file_info.h"
@@ -75,8 +77,9 @@ WebDialogHelper::~WebDialogHelper() {
}
void WebDialogHelper::RunFileChooser(content::WebContents* web_contents,
const content::FileChooserParams& params) {
void WebDialogHelper::RunFileChooser(
content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) {
std::vector<content::FileChooserFileInfo> result;
file_dialog::Filters filters = GetFileTypesFromAcceptType(
params.accept_types);
@@ -133,8 +136,7 @@ void WebDialogHelper::RunFileChooser(content::WebContents* web_contents,
}
}
web_contents->GetRenderViewHost()->FilesSelectedInChooser(
result, params.mode);
render_frame_host->FilesSelectedInChooser(result, params.mode);
}
void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents,

View File

@@ -13,6 +13,7 @@ class FilePath;
namespace content {
struct FileChooserParams;
class RenderFrameHost;
class WebContents;
}
@@ -25,7 +26,7 @@ class WebDialogHelper {
explicit WebDialogHelper(NativeWindow* window);
~WebDialogHelper();
void RunFileChooser(content::WebContents* web_contents,
void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params);
void EnumerateDirectory(content::WebContents* web_contents,
int request_id,

View File

@@ -71,7 +71,8 @@ void WindowList::RemoveObserver(WindowListObserver* observer) {
void WindowList::CloseAllWindows() {
WindowVector windows = GetInstance()->windows_;
for (const auto& window : windows)
window->Close();
if (!window->IsClosed())
window->Close();
}
WindowList::WindowList() {

View File

@@ -6,6 +6,7 @@
#include <string>
#include "atom/common/crash_reporter/crash_reporter.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "base/bind.h"
#include "native_mate/dictionary.h"

View File

@@ -11,7 +11,7 @@
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/base64.h"
#include "base/files/file_util.h"
#include "base/strings/pattern.h"
@@ -25,6 +25,7 @@
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/image/image_util.h"
#if defined(OS_WIN)
@@ -33,6 +34,8 @@
#include "ui/gfx/icon_util.h"
#endif
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
@@ -281,6 +284,57 @@ gfx::Size NativeImage::GetSize() {
return image_.Size();
}
float NativeImage::GetAspectRatio() {
gfx::Size size = GetSize();
if (size.IsEmpty())
return 1.f;
else
return static_cast<float>(size.width()) / static_cast<float>(size.height());
}
mate::Handle<NativeImage> NativeImage::Resize(
v8::Isolate* isolate, const base::DictionaryValue& options) {
gfx::Size size = GetSize();
int width = size.width();
int height = size.height();
bool width_set = options.GetInteger("width", &width);
bool height_set = options.GetInteger("height", &height);
size.SetSize(width, height);
if (width_set && !height_set) {
// Scale height to preserve original aspect ratio
size.set_height(width);
size = gfx::ScaleToRoundedSize(size, 1.f, 1.f / GetAspectRatio());
} else if (height_set && !width_set) {
// Scale width to preserve original aspect ratio
size.set_width(height);
size = gfx::ScaleToRoundedSize(size, GetAspectRatio(), 1.f);
}
skia::ImageOperations::ResizeMethod method =
skia::ImageOperations::ResizeMethod::RESIZE_BEST;
std::string quality;
options.GetString("quality", &quality);
if (quality == "good")
method = skia::ImageOperations::ResizeMethod::RESIZE_GOOD;
else if (quality == "better")
method = skia::ImageOperations::ResizeMethod::RESIZE_BETTER;
gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage(
image_.AsImageSkia(), method, size);
return mate::CreateHandle(isolate,
new NativeImage(isolate, gfx::Image(resized)));
}
mate::Handle<NativeImage> NativeImage::Crop(v8::Isolate* isolate,
const gfx::Rect& rect) {
gfx::ImageSkia cropped = gfx::ImageSkiaOperations::ExtractSubset(
image_.AsImageSkia(), rect);
return mate::CreateHandle(isolate,
new NativeImage(isolate, gfx::Image(cropped)));
}
#if !defined(OS_MACOSX)
void NativeImage::SetTemplateImage(bool setAsTemplate) {
}
@@ -381,6 +435,9 @@ void NativeImage::BuildPrototype(
.SetMethod("getSize", &NativeImage::GetSize)
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
.SetMethod("isTemplateImage", &NativeImage::IsTemplateImage)
.SetMethod("resize", &NativeImage::Resize)
.SetMethod("crop", &NativeImage::Crop)
.SetMethod("getAspectRatio", &NativeImage::GetAspectRatio)
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
.SetMethod("toPng", &NativeImage::ToPNG)
.SetMethod("toJpeg", &NativeImage::ToJPEG);

View File

@@ -8,8 +8,10 @@
#include <map>
#include <string>
#include "base/values.h"
#include "native_mate/handle.h"
#include "native_mate/wrappable.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image.h"
#if defined(OS_WIN)
@@ -75,9 +77,14 @@ class NativeImage : public mate::Wrappable<NativeImage> {
v8::Local<v8::Value> GetNativeHandle(
v8::Isolate* isolate,
mate::Arguments* args);
mate::Handle<NativeImage> Resize(v8::Isolate* isolate,
const base::DictionaryValue& options);
mate::Handle<NativeImage> Crop(v8::Isolate* isolate,
const gfx::Rect& rect);
std::string ToDataURL();
bool IsEmpty();
gfx::Size GetSize();
float GetAspectRatio();
// Mark the image as template image.
void SetTemplateImage(bool setAsTemplate);

View File

@@ -104,7 +104,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("setRemoteObjectFreer", &atom::RemoteObjectFreer::BindTo);
dict.SetMethod("createIDWeakMap", &atom::api::KeyWeakMap<int32_t>::Create);
dict.SetMethod("createDoubleIDWeakMap",
&atom::api::KeyWeakMap<std::pair<int32_t, int32_t>>::Create);
&atom::api::KeyWeakMap<std::pair<int64_t, int32_t>>::Create);
}
} // namespace

View File

@@ -79,10 +79,6 @@ void FatalErrorCallback(const char* location, const char* message) {
Crash();
}
void Log(const base::string16& message) {
std::cout << message << std::flush;
}
} // namespace
@@ -117,8 +113,10 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary versions;
if (dict.Get("versions", &versions)) {
versions.Set(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
versions.Set("atom-shell", ATOM_VERSION_STRING); // For compatibility.
versions.Set("chrome", CHROME_VERSION_STRING);
// TODO(kevinsawicki): Remove in 2.0
versions.Set("atom-shell", ATOM_VERSION_STRING);
}
}
@@ -155,4 +153,9 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) {
self->pending_next_ticks_.clear();
}
// static
void AtomBindings::Log(const base::string16& message) {
std::cout << message << std::flush;
}
} // namespace atom

View File

@@ -24,9 +24,11 @@ class AtomBindings {
virtual ~AtomBindings();
// Add process.atomBinding function, which behaves like process.binding but
// load native code from atom-shell instead.
// load native code from Electron instead.
void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
static void Log(const base::string16& message);
private:
void ActivateUVLoop(v8::Isolate* isolate);

View File

@@ -12,8 +12,7 @@ namespace atom {
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
v8::Local<v8::Object> target)
: isolate_(isolate),
context_(isolate, isolate->GetCurrentContext()),
: context_(isolate, isolate->GetCurrentContext()),
target_(isolate, target),
weak_ptr_factory_(this) {
target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter);

View File

@@ -22,7 +22,6 @@ class ObjectLifeMonitor {
static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
v8::Isolate* isolate_;
v8::Global<v8::Context> context_;
v8::Global<v8::Object> target_;

View File

@@ -6,8 +6,8 @@
#define ATOM_COMMON_ATOM_VERSION_H_
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 3
#define ATOM_PATCH_VERSION 6
#define ATOM_MINOR_VERSION 4
#define ATOM_PATCH_VERSION 4
#define ATOM_VERSION_IS_RELEASE 1

View File

@@ -8,7 +8,7 @@
#ifndef ATOM_COMMON_CHROME_VERSION_H_
#define ATOM_COMMON_CHROME_VERSION_H_
#define CHROME_VERSION_STRING "52.0.2743.82"
#define CHROME_VERSION_STRING "53.0.2785.113"
#define CHROME_VERSION "v" CHROME_VERSION_STRING
#endif // ATOM_COMMON_CHROME_VERSION_H_

View File

@@ -8,6 +8,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
namespace atom {
@@ -45,4 +46,11 @@ SkColor ParseHexColor(const std::string& color_string) {
return SkColorSetARGB(bytes[0], bytes[1], bytes[2], bytes[3]);
}
std::string ToRGBHex(SkColor color) {
return base::StringPrintf("#%02X%02X%02X",
SkColorGetR(color),
SkColorGetG(color),
SkColorGetB(color));
}
} // namespace atom

View File

@@ -14,6 +14,9 @@ namespace atom {
// Parse hex color like "#FFF" or "#EFEFEF"
SkColor ParseHexColor(const std::string& name);
// Convert color to RGB hex value like "#ABCDEF"
std::string ToRGBHex(SkColor color);
} // namespace atom
#endif // ATOM_COMMON_COLOR_UTIL_H_

View File

@@ -25,13 +25,14 @@ CrashReporter::~CrashReporter() {
void CrashReporter::Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler,
const StringMap& extra_parameters) {
SetUploadParameters(extra_parameters);
InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url,
auto_submit, skip_system_crash_handler);
crashes_dir, auto_submit, skip_system_crash_handler);
}
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
@@ -43,11 +44,12 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
}
std::vector<CrashReporter::UploadReportResult>
CrashReporter::GetUploadedReports(const std::string& path) {
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
std::string file_content;
std::vector<CrashReporter::UploadReportResult> result;
if (base::ReadFileToString(base::FilePath::FromUTF8Unsafe(path),
&file_content)) {
base::FilePath uploads_path =
crashes_dir.Append(FILE_PATH_LITERAL("uploads.log"));
if (base::ReadFileToString(uploads_path, &file_content)) {
std::vector<std::string> reports = base::SplitString(
file_content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const std::string& report : reports) {
@@ -68,6 +70,7 @@ void CrashReporter::InitBreakpad(const std::string& product_name,
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) {
}

View File

@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/macros.h"
namespace crash_reporter {
@@ -24,12 +25,13 @@ class CrashReporter {
void Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler,
const StringMap& extra_parameters);
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
const std::string& path);
const base::FilePath& crashes_dir);
protected:
CrashReporter();
@@ -39,6 +41,7 @@ class CrashReporter {
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler);
virtual void SetUploadParameters();

View File

@@ -17,7 +17,6 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/process/memory.h"
#include "base/strings/stringprintf.h"
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
#include "vendor/breakpad/src/common/linux/linux_libc_support.h"
@@ -60,9 +59,10 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) {
EnableCrashDumping(product_name);
EnableCrashDumping(crashes_dir);
crash_keys_.SetKeyValue("prod", ATOM_PRODUCT_NAME);
crash_keys_.SetKeyValue("ver", version.c_str());
@@ -77,16 +77,13 @@ void CrashReporterLinux::SetUploadParameters() {
upload_parameters_["platform"] = "linux";
}
void CrashReporterLinux::EnableCrashDumping(const std::string& product_name) {
std::string dump_dir = "/tmp/" + product_name + " Crashes";
base::FilePath dumps_path(dump_dir);
base::CreateDirectory(dumps_path);
void CrashReporterLinux::EnableCrashDumping(const base::FilePath& crashes_dir) {
base::CreateDirectory(crashes_dir);
std::string log_file = base::StringPrintf(
"%s/%s", dump_dir.c_str(), "uploads.log");
std::string log_file = crashes_dir.Append("uploads.log").value();
strncpy(g_crash_log_path, log_file.c_str(), sizeof(g_crash_log_path));
MinidumpDescriptor minidump_descriptor(dumps_path.value());
MinidumpDescriptor minidump_descriptor(crashes_dir.value());
minidump_descriptor.set_size_limit(kMaxMinidumpFileSize);
breakpad_.reset(new ExceptionHandler(

View File

@@ -31,6 +31,7 @@ class CrashReporterLinux : public CrashReporter {
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;
@@ -41,7 +42,7 @@ class CrashReporterLinux : public CrashReporter {
CrashReporterLinux();
virtual ~CrashReporterLinux();
void EnableCrashDumping(const std::string& product_name);
void EnableCrashDumping(const base::FilePath& crashes_dir);
static bool CrashDone(const google_breakpad::MinidumpDescriptor& minidump,
void* context,

View File

@@ -27,6 +27,7 @@ class CrashReporterMac : public CrashReporter {
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;
@@ -42,7 +43,7 @@ class CrashReporterMac : public CrashReporter {
const base::StringPiece& value);
std::vector<UploadReportResult> GetUploadedReports(
const std::string& path) override;
const base::FilePath& crashes_dir) override;
std::unique_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;

View File

@@ -6,7 +6,6 @@
#include <memory>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
@@ -31,15 +30,14 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) {
// check whether crashpad has been initilized.
// Only need to initilize once.
// check whether crashpad has been initialized.
// Only need to initialize once.
if (simple_string_dictionary_)
return;
std::string dump_dir = "/tmp/" + product_name + " Crashes";
base::FilePath database_path(dump_dir);
if (is_browser_) {
@autoreleasepool {
base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
@@ -47,7 +45,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
framework_bundle_path.Append("Resources").Append("crashpad_handler");
crashpad::CrashpadClient crashpad_client;
if (crashpad_client.StartHandler(handler_path, database_path,
if (crashpad_client.StartHandler(handler_path, crashes_dir,
submit_url,
StringMap(),
std::vector<std::string>(),
@@ -76,7 +74,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
}
if (is_browser_) {
std::unique_ptr<crashpad::CrashReportDatabase> database =
crashpad::CrashReportDatabase::Initialize(database_path);
crashpad::CrashReportDatabase::Initialize(crashes_dir);
if (database) {
database->GetSettings()->SetUploadsEnabled(auto_submit);
}
@@ -93,16 +91,15 @@ void CrashReporterMac::SetCrashKeyValue(const base::StringPiece& key,
}
std::vector<CrashReporter::UploadReportResult>
CrashReporterMac::GetUploadedReports(const std::string& path) {
CrashReporterMac::GetUploadedReports(const base::FilePath& crashes_dir) {
std::vector<CrashReporter::UploadReportResult> uploaded_reports;
base::FilePath file_path(path);
if (!base::PathExists(file_path)) {
if (!base::PathExists(crashes_dir)) {
return uploaded_reports;
}
// Load crashpad database.
std::unique_ptr<crashpad::CrashReportDatabase> database =
crashpad::CrashReportDatabase::Initialize(file_path);
crashpad::CrashReportDatabase::Initialize(crashes_dir);
DCHECK(database);
std::vector<crashpad::CrashReportDatabase::Report> completed_reports;

View File

@@ -149,16 +149,11 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) {
skip_system_crash_handler_ = skip_system_crash_handler;
base::FilePath temp_dir;
if (!base::GetTempDir(&temp_dir)) {
LOG(ERROR) << "Cannot get temp directory";
return;
}
base::string16 pipe_name = base::ReplaceStringPlaceholders(
kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);
base::string16 wait_name = base::ReplaceStringPlaceholders(
@@ -177,7 +172,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
breakpad_.reset();
breakpad_.reset(new google_breakpad::ExceptionHandler(
temp_dir.value(),
crashes_dir.DirName().value(),
FilterCallback,
MinidumpCallback,
this,

View File

@@ -27,6 +27,7 @@ class CrashReporterWin : public CrashReporter {
const std::string& version,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;

View File

@@ -16,6 +16,7 @@ namespace crash_service {
namespace {
const char kApplicationName[] = "application-name";
const char kCrashesDirectory[] = "crashes-directory";
const wchar_t kPipeNameFormat[] = L"\\\\.\\pipe\\$1 Crash Service";
const wchar_t kStandardLogFile[] = L"operation_log.txt";
@@ -25,17 +26,11 @@ void InvalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*,
// noop.
}
bool GetCrashServiceDirectory(const std::wstring& application_name,
base::FilePath* dir) {
base::FilePath temp_dir;
if (!base::GetTempDir(&temp_dir))
return false;
temp_dir = temp_dir.Append(application_name + L" Crashes");
bool CreateCrashServiceDirectory(const base::FilePath& temp_dir) {
if (!base::PathExists(temp_dir)) {
if (!base::CreateDirectory(temp_dir))
return false;
}
*dir = temp_dir;
return true;
}
@@ -59,9 +54,16 @@ int Main(const wchar_t* cmd) {
std::wstring application_name = cmd_line.GetSwitchValueNative(
kApplicationName);
if (!cmd_line.HasSwitch(kCrashesDirectory)) {
LOG(ERROR) << "Crashes directory path must be specified with --"
<< kCrashesDirectory;
return 1;
}
// We use/create a directory under the user's temp folder, for logging.
base::FilePath operating_dir;
GetCrashServiceDirectory(application_name, &operating_dir);
base::FilePath operating_dir(
cmd_line.GetSwitchValueNative(kCrashesDirectory));
CreateCrashServiceDirectory(operating_dir);
base::FilePath log_file = operating_dir.Append(kStandardLogFile);
// Logging to stderr (to help with debugging failures on the

View File

@@ -5,6 +5,11 @@
#ifndef ATOM_COMMON_GOOGLE_API_KEY_H_
#define ATOM_COMMON_GOOGLE_API_KEY_H_
#ifndef GOOGLEAPIS_ENDPOINT
#define GOOGLEAPIS_ENDPOINT \
"https://www.googleapis.com/geolocation/v1/geolocate?key="
#endif
#ifndef GOOGLEAPIS_API_KEY
#define GOOGLEAPIS_API_KEY "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q"
#endif

View File

@@ -7,6 +7,8 @@
#include "atom/common/keyboard_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/events/event_constants.h"
namespace atom {
@@ -174,4 +176,33 @@ ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted) {
return KeyboardCodeFromKeyIdentifier(str, shifted);
}
int WebEventModifiersToEventFlags(int modifiers) {
int flags = 0;
if (modifiers & blink::WebInputEvent::ShiftKey)
flags |= ui::EF_SHIFT_DOWN;
if (modifiers & blink::WebInputEvent::ControlKey)
flags |= ui::EF_CONTROL_DOWN;
if (modifiers & blink::WebInputEvent::AltKey)
flags |= ui::EF_ALT_DOWN;
if (modifiers & blink::WebInputEvent::MetaKey)
flags |= ui::EF_COMMAND_DOWN;
if (modifiers & blink::WebInputEvent::CapsLockOn)
flags |= ui::EF_CAPS_LOCK_ON;
if (modifiers & blink::WebInputEvent::NumLockOn)
flags |= ui::EF_NUM_LOCK_ON;
if (modifiers & blink::WebInputEvent::ScrollLockOn)
flags |= ui::EF_SCROLL_LOCK_ON;
if (modifiers & blink::WebInputEvent::LeftButtonDown)
flags |= ui::EF_LEFT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::MiddleButtonDown)
flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::RightButtonDown)
flags |= ui::EF_RIGHT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::IsAutoRepeat)
flags |= ui::EF_IS_REPEAT;
return flags;
}
} // namespace atom

Some files were not shown because too many files have changed in this diff Show More