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

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

Issue 132993002: app_shell: Fix PrefsTabHelper dependency of ExtensionHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/extensions/error_console/error_console.h" 18 #include "chrome/browser/extensions/error_console/error_console.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system.h" 20 #include "chrome/browser/extensions/extension_system.h"
21 #include "chrome/browser/extensions/extension_tab_util.h" 21 #include "chrome/browser/extensions/extension_tab_util.h"
22 #include "chrome/browser/extensions/extension_web_contents_observer.h" 22 #include "chrome/browser/extensions/extension_web_contents_observer.h"
23 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 23 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
24 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
25 #include "chrome/common/chrome_constants.h" 24 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
27 #include "chrome/common/extensions/extension_messages.h" 26 #include "chrome/common/extensions/extension_messages.h"
28 #include "chrome/common/render_messages.h" 27 #include "chrome/common/render_messages.h"
29 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
30 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
31 #include "content/public/browser/content_browser_client.h" 30 #include "content/public/browser/content_browser_client.h"
32 #include "content/public/browser/native_web_keyboard_event.h" 31 #include "content/public/browser/native_web_keyboard_event.h"
33 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 host_type == VIEW_TYPE_EXTENSION_DIALOG || 134 host_type == VIEW_TYPE_EXTENSION_DIALOG ||
136 host_type == VIEW_TYPE_EXTENSION_INFOBAR || 135 host_type == VIEW_TYPE_EXTENSION_INFOBAR ||
137 host_type == VIEW_TYPE_EXTENSION_POPUP); 136 host_type == VIEW_TYPE_EXTENSION_POPUP);
138 host_contents_.reset(WebContents::Create( 137 host_contents_.reset(WebContents::Create(
139 WebContents::CreateParams(browser_context_, site_instance))), 138 WebContents::CreateParams(browser_context_, site_instance))),
140 content::WebContentsObserver::Observe(host_contents_.get()); 139 content::WebContentsObserver::Observe(host_contents_.get());
141 host_contents_->SetDelegate(this); 140 host_contents_->SetDelegate(this);
142 SetViewType(host_contents_.get(), host_type); 141 SetViewType(host_contents_.get(), host_type);
143 142
144 ExtensionWebContentsObserver::CreateForWebContents(host_contents()); 143 ExtensionWebContentsObserver::CreateForWebContents(host_contents());
145 PrefsTabHelper::CreateForWebContents(host_contents());
146 144
147 render_view_host_ = host_contents_->GetRenderViewHost(); 145 render_view_host_ = host_contents_->GetRenderViewHost();
148 146
149 // Listen for when an extension is unloaded from the same profile, as it may 147 // Listen for when an extension is unloaded from the same profile, as it may
150 // be the same extension that this points to. 148 // be the same extension that this points to.
151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
152 content::Source<BrowserContext>(browser_context_)); 150 content::Source<BrowserContext>(browser_context_));
151
152 ExtensionsBrowserClient::Get()->OnExtensionHostCreated(host_contents());
153 } 153 }
154 154
155 ExtensionHost::~ExtensionHost() { 155 ExtensionHost::~ExtensionHost() {
156 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && 156 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE &&
157 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { 157 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) {
158 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", 158 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime",
159 since_created_.Elapsed()); 159 since_created_.Elapsed());
160 } 160 }
161 content::NotificationService::current()->Notify( 161 content::NotificationService::current()->Notify(
162 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 162 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 void ExtensionHost::RequestMediaAccessPermission( 458 void ExtensionHost::RequestMediaAccessPermission(
459 content::WebContents* web_contents, 459 content::WebContents* web_contents,
460 const content::MediaStreamRequest& request, 460 const content::MediaStreamRequest& request,
461 const content::MediaResponseCallback& callback) { 461 const content::MediaResponseCallback& callback) {
462 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( 462 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
463 web_contents, request, callback, extension()); 463 web_contents, request, callback, extension());
464 } 464 }
465 465
466 } // namespace extensions 466 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_extensions_browser_client.cc ('k') | extensions/browser/extensions_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698