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

Side by Side Diff: chrome/browser/chromeos/accessibility_util.cc

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Profile helper function, rebase Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_util.h" 5 #include "chrome/browser/chromeos/accessibility_util.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_accessibility_api.h" 10 #include "chrome/browser/extensions/extension_accessibility_api.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/file_reader.h" 12 #include "chrome/browser/extensions/file_reader.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/common/extensions/extension_messages.h" 15 #include "chrome/common/extensions/extension_messages.h"
16 #include "chrome/common/extensions/extension_resource.h" 16 #include "chrome/common/extensions/extension_resource.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/browser/webui/web_ui.h" 20 #include "content/browser/webui/web_ui.h"
19 #include "content/browser/renderer_host/render_view_host.h"
20 #include "grit/browser_resources.h" 21 #include "grit/browser_resources.h"
21 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
22 23
23 namespace chromeos { 24 namespace chromeos {
24 namespace accessibility { 25 namespace accessibility {
25 26
26 // Helper class that directly loads an extension's content scripts into 27 // Helper class that directly loads an extension's content scripts into
27 // all of the frames corresponding to a given RenderViewHost. 28 // all of the frames corresponding to a given RenderViewHost.
28 class ContentScriptLoader { 29 class ContentScriptLoader {
29 public: 30 public:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 GetRawDataResource(IDR_CHROMEVOX_MANIFEST).as_string(); 100 GetRawDataResource(IDR_CHROMEVOX_MANIFEST).as_string();
100 FilePath path = FilePath(extension_misc::kAccessExtensionPath) 101 FilePath path = FilePath(extension_misc::kAccessExtensionPath)
101 .AppendASCII(extension_misc::kChromeVoxDirectoryName); 102 .AppendASCII(extension_misc::kChromeVoxDirectoryName);
102 ExtensionService::ComponentExtensionInfo info(manifest, path); 103 ExtensionService::ComponentExtensionInfo info(manifest, path);
103 if (enabled) { // Load ChromeVox 104 if (enabled) { // Load ChromeVox
104 extension_service->register_component_extension(info); 105 extension_service->register_component_extension(info);
105 const Extension* extension = 106 const Extension* extension =
106 extension_service->LoadComponentExtension(info); 107 extension_service->LoadComponentExtension(info);
107 108
108 if (login_web_ui) { 109 if (login_web_ui) {
109 RenderViewHost* render_view_host = login_web_ui->GetRenderViewHost(); 110 RenderViewHost* render_view_host =
111 login_web_ui->tab_contents()->render_view_host();
110 ContentScriptLoader* loader = new ContentScriptLoader( 112 ContentScriptLoader* loader = new ContentScriptLoader(
111 extension->id(), render_view_host); 113 extension->id(), render_view_host);
112 114
113 for (size_t i = 0; i < extension->content_scripts().size(); i++) { 115 for (size_t i = 0; i < extension->content_scripts().size(); i++) {
114 const UserScript& script = extension->content_scripts()[i]; 116 const UserScript& script = extension->content_scripts()[i];
115 for (size_t j = 0; j < script.js_scripts().size(); ++j) { 117 for (size_t j = 0; j < script.js_scripts().size(); ++j) {
116 const UserScript::File &file = script.js_scripts()[j]; 118 const UserScript::File &file = script.js_scripts()[j];
117 ExtensionResource resource = extension->GetResource( 119 ExtensionResource resource = extension->GetResource(
118 file.relative_path()); 120 file.relative_path());
119 loader->AppendScript(resource); 121 loader->AppendScript(resource);
(...skipping 13 matching lines...) Expand all
133 void ToggleAccessibility(WebUI* login_web_ui) { 135 void ToggleAccessibility(WebUI* login_web_ui) {
134 bool accessibility_enabled = g_browser_process && 136 bool accessibility_enabled = g_browser_process &&
135 g_browser_process->local_state()->GetBoolean( 137 g_browser_process->local_state()->GetBoolean(
136 prefs::kAccessibilityEnabled); 138 prefs::kAccessibilityEnabled);
137 accessibility_enabled = !accessibility_enabled; 139 accessibility_enabled = !accessibility_enabled;
138 EnableAccessibility(accessibility_enabled, login_web_ui); 140 EnableAccessibility(accessibility_enabled, login_web_ui);
139 }; 141 };
140 142
141 } // namespace accessibility 143 } // namespace accessibility
142 } // namespace chromeos 144 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698