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

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 159763: Rolling back change 22245. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/extensions/extension_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
11 #include "chrome/browser/browser_list.h" 11 #include "chrome/browser/browser_list.h"
12 #include "chrome/browser/debugger/devtools_manager.h" 12 #include "chrome/browser/debugger/devtools_manager.h"
13 #include "chrome/browser/extensions/extension_message_service.h" 13 #include "chrome/browser/extensions/extension_message_service.h"
14 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
15 #include "chrome/browser/renderer_host/render_view_host.h" 15 #include "chrome/browser/renderer_host/render_view_host.h"
16 #include "chrome/browser/renderer_host/render_process_host.h" 16 #include "chrome/browser/renderer_host/render_process_host.h"
17 #include "chrome/browser/renderer_host/render_widget_host.h" 17 #include "chrome/browser/renderer_host/render_widget_host.h"
18 #include "chrome/browser/renderer_host/render_widget_host_view.h" 18 #include "chrome/browser/renderer_host/render_widget_host_view.h"
19 #include "chrome/browser/renderer_host/site_instance.h" 19 #include "chrome/browser/renderer_host/site_instance.h"
20 #include "chrome/browser/tab_contents/infobar_delegate.h" 20 #include "chrome/browser/tab_contents/infobar_delegate.h"
21 #include "chrome/browser/tab_contents/tab_contents.h" 21 #include "chrome/browser/tab_contents/tab_contents.h"
22 #include "chrome/browser/tab_contents/tab_contents_view.h" 22 #include "chrome/browser/tab_contents/tab_contents_view.h"
23 #include "chrome/common/bindings_policy.h" 23 #include "chrome/common/bindings_policy.h"
24 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
25 #include "chrome/common/notification_service.h" 25 #include "chrome/common/notification_service.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "chrome/common/pref_service.h" 27 #include "chrome/common/pref_service.h"
28 #include "chrome/common/render_messages.h" 28 #include "chrome/common/render_messages.h"
29 #include "chrome/common/url_constants.h"
30 29
31 #include "grit/browser_resources.h" 30 #include "grit/browser_resources.h"
32 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
33 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
34 33
35 #include "webkit/glue/context_menu.h" 34 #include "webkit/glue/context_menu.h"
36 35
37 namespace { 36 namespace {
38 37
39 class CrashedExtensionInfobarDelegate : public ConfirmInfoBarDelegate { 38 class CrashedExtensionInfobarDelegate : public ConfirmInfoBarDelegate {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void ExtensionHost::DidNavigate(RenderViewHost* render_view_host, 186 void ExtensionHost::DidNavigate(RenderViewHost* render_view_host,
188 const ViewHostMsg_FrameNavigate_Params& params) { 187 const ViewHostMsg_FrameNavigate_Params& params) {
189 // We only care when the outer frame changes. 188 // We only care when the outer frame changes.
190 switch (params.transition) { 189 switch (params.transition) {
191 case PageTransition::AUTO_SUBFRAME: 190 case PageTransition::AUTO_SUBFRAME:
192 case PageTransition::MANUAL_SUBFRAME: 191 case PageTransition::MANUAL_SUBFRAME:
193 return; 192 return;
194 } 193 }
195 194
196 url_ = params.url; 195 url_ = params.url;
197 if (!url_.SchemeIs(chrome::kExtensionScheme)) {
198 extension_function_dispatcher_.reset(NULL);
199 return;
200 }
201 extension_function_dispatcher_.reset( 196 extension_function_dispatcher_.reset(
202 new ExtensionFunctionDispatcher(render_view_host_, this, url_)); 197 new ExtensionFunctionDispatcher(render_view_host_, this, url_));
203 } 198 }
204 199
205 void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { 200 void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) {
206 #if defined(TOOLKIT_VIEWS) 201 #if defined(TOOLKIT_VIEWS)
207 ExtensionView* view = view_.get(); 202 ExtensionView* view = view_.get();
208 if (view) { 203 if (view) {
209 // TODO(erikkay) this injection should really happen in the renderer. 204 // TODO(erikkay) this injection should really happen in the renderer.
210 // When the Jerry's view type change lands, investigate moving this there. 205 // When the Jerry's view type change lands, investigate moving this there.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 WebPreferences ExtensionHost::GetWebkitPrefs() { 237 WebPreferences ExtensionHost::GetWebkitPrefs() {
243 PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); 238 PrefService* prefs = render_view_host()->process()->profile()->GetPrefs();
244 const bool kIsDomUI = true; 239 const bool kIsDomUI = true;
245 return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI); 240 return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI);
246 } 241 }
247 242
248 void ExtensionHost::ProcessDOMUIMessage(const std::string& message, 243 void ExtensionHost::ProcessDOMUIMessage(const std::string& message,
249 const std::string& content, 244 const std::string& content,
250 int request_id, 245 int request_id,
251 bool has_callback) { 246 bool has_callback) {
252 if (extension_function_dispatcher_.get()) { 247 extension_function_dispatcher_->HandleRequest(message, content, request_id,
253 extension_function_dispatcher_->HandleRequest(message, content, request_id, 248 has_callback);
254 has_callback);
255 }
256 } 249 }
257 250
258 void ExtensionHost::DidInsertCSS() { 251 void ExtensionHost::DidInsertCSS() {
259 #if defined(TOOLKIT_VIEWS) 252 #if defined(TOOLKIT_VIEWS)
260 if (view_.get()) 253 if (view_.get())
261 view_->SetDidInsertCSS(true); 254 view_->SetDidInsertCSS(true);
262 #endif 255 #endif
263 } 256 }
264 257
265 RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { 258 RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // a toolstrip or background_page onload chrome.tabs api call can make it 346 // a toolstrip or background_page onload chrome.tabs api call can make it
354 // into here before the browser is sufficiently initialized to return here. 347 // into here before the browser is sufficiently initialized to return here.
355 // A similar situation may arise during shutdown. 348 // A similar situation may arise during shutdown.
356 // TODO(rafaelw): Delay creation of background_page until the browser 349 // TODO(rafaelw): Delay creation of background_page until the browser
357 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 350 // is available. http://code.google.com/p/chromium/issues/detail?id=13284
358 return browser; 351 return browser;
359 } 352 }
360 353
361 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { 354 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
362 } 355 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_shelf_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698