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

Side by Side Diff: chrome/browser/ui/fast_unload_controller.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | chrome/browser/ui/login/login_handler.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/fast_unload_controller.h" 5 #include "chrome/browser/ui/fast_unload_controller.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/devtools/devtools_window.h" 13 #include "chrome/browser/devtools/devtools_window.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 15 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 16 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_contents_delegate.h" 24 #include "content/public/browser/web_contents_delegate.h"
25 #include "extensions/features/features.h"
25 26
26 #if defined (ENABLE_EXTENSIONS) 27 #if BUILDFLAG(ENABLE_EXTENSIONS)
27 #include "extensions/browser/extension_registry.h" 28 #include "extensions/browser/extension_registry.h"
28 #include "extensions/common/constants.h" 29 #include "extensions/common/constants.h"
29 #endif // (ENABLE_EXTENSIONS) 30 #endif // (ENABLE_EXTENSIONS)
30 31
31 namespace chrome { 32 namespace chrome {
32 33
33 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
34 // DetachedWebContentsDelegate will delete web contents when they close. 35 // DetachedWebContentsDelegate will delete web contents when they close.
35 class FastUnloadController::DetachedWebContentsDelegate 36 class FastUnloadController::DetachedWebContentsDelegate
36 : public content::WebContentsDelegate { 37 : public content::WebContentsDelegate {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 bool FastUnloadController::ShouldRunUnloadEventsHelper( 81 bool FastUnloadController::ShouldRunUnloadEventsHelper(
81 content::WebContents* contents) { 82 content::WebContents* contents) {
82 // If |contents| is being inspected, devtools needs to intercept beforeunload 83 // If |contents| is being inspected, devtools needs to intercept beforeunload
83 // events. 84 // events.
84 return DevToolsWindow::GetInstanceForInspectedWebContents(contents) != NULL; 85 return DevToolsWindow::GetInstanceForInspectedWebContents(contents) != NULL;
85 } 86 }
86 87
87 bool FastUnloadController::RunUnloadEventsHelper( 88 bool FastUnloadController::RunUnloadEventsHelper(
88 content::WebContents* contents) { 89 content::WebContents* contents) {
89 #if defined (ENABLE_EXTENSIONS) 90 #if BUILDFLAG(ENABLE_EXTENSIONS)
90 // Don't run for extensions that are disabled or uninstalled; the tabs will 91 // Don't run for extensions that are disabled or uninstalled; the tabs will
91 // be killed if they make any network requests, and the extension shouldn't 92 // be killed if they make any network requests, and the extension shouldn't
92 // be doing any work if it's removed. 93 // be doing any work if it's removed.
93 GURL url = contents->GetLastCommittedURL(); 94 GURL url = contents->GetLastCommittedURL();
94 if (url.SchemeIs(extensions::kExtensionScheme) && 95 if (url.SchemeIs(extensions::kExtensionScheme) &&
95 !extensions::ExtensionRegistry::Get(browser_->profile()) 96 !extensions::ExtensionRegistry::Get(browser_->profile())
96 ->enabled_extensions() 97 ->enabled_extensions()
97 .GetExtensionOrAppByURL(url)) { 98 .GetExtensionOrAppByURL(url)) {
98 return false; 99 return false;
99 } 100 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 491 }
491 } 492 }
492 493
493 void FastUnloadController::PostTaskForProcessPendingTabs() { 494 void FastUnloadController::PostTaskForProcessPendingTabs() {
494 base::ThreadTaskRunnerHandle::Get()->PostTask( 495 base::ThreadTaskRunnerHandle::Get()->PostTask(
495 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs, 496 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs,
496 weak_factory_.GetWeakPtr())); 497 weak_factory_.GetWeakPtr()));
497 } 498 }
498 499
499 } // namespace chrome 500 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | chrome/browser/ui/login/login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698