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

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

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" 26 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
27 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/browser/ui/browser_window.h" 30 #include "chrome/browser/ui/browser_window.h"
31 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 31 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
32 #include "chrome/browser/view_type_utils.h" 32 #include "chrome/browser/view_type_utils.h"
33 #include "chrome/common/chrome_constants.h" 33 #include "chrome/common/chrome_constants.h"
34 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/extensions/background_info.h"
35 #include "chrome/common/extensions/extension.h" 36 #include "chrome/common/extensions/extension.h"
36 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
37 #include "chrome/common/extensions/extension_messages.h" 38 #include "chrome/common/extensions/extension_messages.h"
38 #include "chrome/common/extensions/feature_switch.h" 39 #include "chrome/common/extensions/feature_switch.h"
39 #include "chrome/common/extensions/request_media_access_permission_helper.h" 40 #include "chrome/common/extensions/request_media_access_permission_helper.h"
40 #include "chrome/common/render_messages.h" 41 #include "chrome/common/render_messages.h"
41 #include "chrome/common/url_constants.h" 42 #include "chrome/common/url_constants.h"
42 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
43 #include "content/public/browser/native_web_keyboard_event.h" 44 #include "content/public/browser/native_web_keyboard_event.h"
44 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 render_view_host_ = host_contents_->GetRenderViewHost(); 152 render_view_host_ = host_contents_->GetRenderViewHost();
152 153
153 // Listen for when an extension is unloaded from the same profile, as it may 154 // Listen for when an extension is unloaded from the same profile, as it may
154 // be the same extension that this points to. 155 // be the same extension that this points to.
155 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
156 content::Source<Profile>(profile_)); 157 content::Source<Profile>(profile_));
157 } 158 }
158 159
159 ExtensionHost::~ExtensionHost() { 160 ExtensionHost::~ExtensionHost() {
160 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && 161 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE &&
161 extension_ && extension_->has_lazy_background_page()) { 162 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) {
162 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", 163 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime",
163 since_created_.Elapsed()); 164 since_created_.Elapsed());
164 } 165 }
165 content::NotificationService::current()->Notify( 166 content::NotificationService::current()->Notify(
166 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 167 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
167 content::Source<Profile>(profile_), 168 content::Source<Profile>(profile_),
168 content::Details<ExtensionHost>(this)); 169 content::Details<ExtensionHost>(this));
169 ProcessCreationQueue::GetInstance()->Remove(this); 170 ProcessCreationQueue::GetInstance()->Remove(this);
170 } 171 }
171 172
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || 345 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG ||
345 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || 346 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR ||
346 extension_host_type_ == chrome::VIEW_TYPE_PANEL) { 347 extension_host_type_ == chrome::VIEW_TYPE_PANEL) {
347 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) 348 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
348 if (view()) 349 if (view())
349 view()->DidStopLoading(); 350 view()->DidStopLoading();
350 #endif 351 #endif
351 } 352 }
352 if (notify) { 353 if (notify) {
353 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 354 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
354 if (extension_ && extension_->has_lazy_background_page()) { 355 if (extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) {
355 UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime", 356 UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime",
356 since_created_.Elapsed()); 357 since_created_.Elapsed());
357 } else { 358 } else {
358 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", 359 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime",
359 since_created_.Elapsed()); 360 since_created_.Elapsed());
360 } 361 }
361 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { 362 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) {
362 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", 363 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime",
363 since_created_.Elapsed()); 364 since_created_.Elapsed());
364 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { 365 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 content::IsAudioMediaType(request.audio_type), 634 content::IsAudioMediaType(request.audio_type),
634 content::IsVideoMediaType(request.video_type), 635 content::IsVideoMediaType(request.video_type),
635 &devices); 636 &devices);
636 637
637 // For tab capture device, we require the tabCapture permission. 638 // For tab capture device, we require the tabCapture permission.
638 RequestMediaAccessPermissionHelper::AuthorizeRequest( 639 RequestMediaAccessPermissionHelper::AuthorizeRequest(
639 devices, request, callback, extension(), false); 640 devices, request, callback, extension(), false);
640 } 641 }
641 642
642 } // namespace extensions 643 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698