Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 942533003: Enable <webview>.executeScript outside of Apps and Extensions [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_UserScriptSet_non_hostset_2
Patch Set: Add a test. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include "ash/audio/sounds.h" 7 #include "ash/audio/sounds.h"
8 #include "ash/autoclick/autoclick_controller.h" 8 #include "ash/autoclick/autoclick_controller.h"
9 #include "ash/high_contrast/high_contrast_controller.h" 9 #include "ash/high_contrast/high_contrast_controller.h"
10 #include "ash/metrics/user_metrics_recorder.h" 10 #include "ash/metrics/user_metrics_recorder.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "content/public/browser/render_process_host.h" 55 #include "content/public/browser/render_process_host.h"
56 #include "content/public/browser/render_view_host.h" 56 #include "content/public/browser/render_view_host.h"
57 #include "content/public/browser/web_contents.h" 57 #include "content/public/browser/web_contents.h"
58 #include "content/public/browser/web_ui.h" 58 #include "content/public/browser/web_ui.h"
59 #include "extensions/browser/extension_registry.h" 59 #include "extensions/browser/extension_registry.h"
60 #include "extensions/browser/extension_system.h" 60 #include "extensions/browser/extension_system.h"
61 #include "extensions/browser/file_reader.h" 61 #include "extensions/browser/file_reader.h"
62 #include "extensions/common/extension.h" 62 #include "extensions/common/extension.h"
63 #include "extensions/common/extension_messages.h" 63 #include "extensions/common/extension_messages.h"
64 #include "extensions/common/extension_resource.h" 64 #include "extensions/common/extension_resource.h"
65 #include "extensions/common/host_id.h"
65 #include "media/audio/sounds/sounds_manager.h" 66 #include "media/audio/sounds/sounds_manager.h"
66 #include "ui/base/ime/chromeos/input_method_manager.h" 67 #include "ui/base/ime/chromeos/input_method_manager.h"
67 #include "ui/base/resource/resource_bundle.h" 68 #include "ui/base/resource/resource_bundle.h"
68 #include "ui/keyboard/keyboard_controller.h" 69 #include "ui/keyboard/keyboard_controller.h"
69 #include "ui/keyboard/keyboard_util.h" 70 #include "ui/keyboard/keyboard_util.h"
70 71
71 using content::BrowserThread; 72 using content::BrowserThread;
72 using content::RenderViewHost; 73 using content::RenderViewHost;
73 using extensions::api::braille_display_private::BrailleController; 74 using extensions::api::braille_display_private::BrailleController;
74 using extensions::api::braille_display_private::DisplayState; 75 using extensions::api::braille_display_private::DisplayState;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind( 129 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind(
129 &ContentScriptLoader::OnFileLoaded, base::Unretained(this)))); 130 &ContentScriptLoader::OnFileLoaded, base::Unretained(this))));
130 reader->Start(); 131 reader->Start();
131 } 132 }
132 133
133 private: 134 private:
134 void OnFileLoaded(bool success, const std::string& data) { 135 void OnFileLoaded(bool success, const std::string& data) {
135 if (success) { 136 if (success) {
136 ExtensionMsg_ExecuteCode_Params params; 137 ExtensionMsg_ExecuteCode_Params params;
137 params.request_id = 0; 138 params.request_id = 0;
138 params.extension_id = extension_id_; 139 params.host_id = HostID(HostID::EXTENSIONS, extension_id_);
139 params.is_javascript = true; 140 params.is_javascript = true;
140 params.code = data; 141 params.code = data;
141 params.run_at = extensions::UserScript::DOCUMENT_IDLE; 142 params.run_at = extensions::UserScript::DOCUMENT_IDLE;
142 params.all_frames = true; 143 params.all_frames = true;
143 params.match_about_blank = false; 144 params.match_about_blank = false;
144 params.in_main_world = false; 145 params.in_main_world = false;
145 146
146 RenderViewHost* render_view_host = 147 RenderViewHost* render_view_host =
147 RenderViewHost::FromID(render_process_id_, render_view_id_); 148 RenderViewHost::FromID(render_process_id_, render_view_id_);
148 if (render_view_host) { 149 if (render_view_host) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return; 198 return;
198 const extensions::Extension* extension = 199 const extensions::Extension* extension =
199 extensions::ExtensionRegistry::Get(extension_service->profile()) 200 extensions::ExtensionRegistry::Get(extension_service->profile())
200 ->enabled_extensions() 201 ->enabled_extensions()
201 .GetByID(extension_misc::kChromeVoxExtensionId); 202 .GetByID(extension_misc::kChromeVoxExtensionId);
202 203
203 // Set a flag to tell ChromeVox that it's just been enabled, 204 // Set a flag to tell ChromeVox that it's just been enabled,
204 // so that it won't interrupt our speech feedback enabled message. 205 // so that it won't interrupt our speech feedback enabled message.
205 ExtensionMsg_ExecuteCode_Params params; 206 ExtensionMsg_ExecuteCode_Params params;
206 params.request_id = 0; 207 params.request_id = 0;
207 params.extension_id = extension->id(); 208 params.host_id = HostID(HostID::EXTENSIONS, extension->id());
208 params.is_javascript = true; 209 params.is_javascript = true;
209 params.code = "window.INJECTED_AFTER_LOAD = true;"; 210 params.code = "window.INJECTED_AFTER_LOAD = true;";
210 params.run_at = extensions::UserScript::DOCUMENT_IDLE; 211 params.run_at = extensions::UserScript::DOCUMENT_IDLE;
211 params.all_frames = true; 212 params.all_frames = true;
212 params.match_about_blank = false; 213 params.match_about_blank = false;
213 params.in_main_world = false; 214 params.in_main_world = false;
214 render_view_host->Send(new ExtensionMsg_ExecuteCode( 215 render_view_host->Send(new ExtensionMsg_ExecuteCode(
215 render_view_host->GetRoutingID(), params)); 216 render_view_host->GetRoutingID(), params));
216 217
217 // Inject ChromeVox' content scripts. 218 // Inject ChromeVox' content scripts.
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { 1111 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) {
1111 // Do any teardown work needed immediately after ChromeVox actually unloads. 1112 // Do any teardown work needed immediately after ChromeVox actually unloads.
1112 if (system_sounds_enabled_) 1113 if (system_sounds_enabled_)
1113 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); 1114 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED);
1114 // Clear the accessibility focus ring. 1115 // Clear the accessibility focus ring.
1115 AccessibilityFocusRingController::GetInstance()->SetFocusRing( 1116 AccessibilityFocusRingController::GetInstance()->SetFocusRing(
1116 std::vector<gfx::Rect>()); 1117 std::vector<gfx::Rect>());
1117 } 1118 }
1118 1119
1119 } // namespace chromeos 1120 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | chrome/test/data/webui/webview_execute_script_test.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698