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

Side by Side Diff: chrome/browser/sessions/chrome_tab_restore_service_client.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/sessions/chrome_tab_restore_service_client.h" 5 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_service.h" 9 #include "chrome/browser/sessions/session_service.h"
10 #include "chrome/browser/sessions/session_service_factory.h" 10 #include "chrome/browser/sessions/session_service_factory.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "components/sessions/content/content_live_tab.h" 12 #include "components/sessions/content/content_live_tab.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "extensions/features/features.h"
14 15
15 #if defined(ENABLE_EXTENSIONS) 16 #if BUILDFLAG(ENABLE_EXTENSIONS)
16 #include "chrome/browser/extensions/tab_helper.h" 17 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/common/extensions/extension_constants.h" 18 #include "chrome/common/extensions/extension_constants.h"
18 #include "chrome/common/extensions/extension_metrics.h" 19 #include "chrome/common/extensions/extension_metrics.h"
19 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
20 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
21 #include "extensions/common/extension_set.h" 22 #include "extensions/common/extension_set.h"
22 #endif 23 #endif
23 24
24 #if !defined(OS_ANDROID) 25 #if !defined(OS_ANDROID)
25 #include "chrome/browser/ui/browser_live_tab_context.h" 26 #include "chrome/browser/ui/browser_live_tab_context.h"
26 #else 27 #else
27 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" 28 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h"
28 #endif 29 #endif
29 30
30 namespace { 31 namespace {
31 32
32 void RecordAppLaunch(Profile* profile, const GURL& url) { 33 void RecordAppLaunch(Profile* profile, const GURL& url) {
33 #if defined(ENABLE_EXTENSIONS) 34 #if BUILDFLAG(ENABLE_EXTENSIONS)
34 const extensions::Extension* extension = 35 const extensions::Extension* extension =
35 extensions::ExtensionRegistry::Get(profile) 36 extensions::ExtensionRegistry::Get(profile)
36 ->enabled_extensions() 37 ->enabled_extensions()
37 .GetAppByURL(url); 38 .GetAppByURL(url);
38 if (!extension) 39 if (!extension)
39 return; 40 return;
40 41
41 extensions::RecordAppLaunchType( 42 extensions::RecordAppLaunchType(
42 extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED, extension->GetType()); 43 extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED, extension->GetType());
43 #endif // defined(ENABLE_EXTENSIONS) 44 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
44 } 45 }
45 46
46 } // namespace 47 } // namespace
47 48
48 ChromeTabRestoreServiceClient::ChromeTabRestoreServiceClient(Profile* profile) 49 ChromeTabRestoreServiceClient::ChromeTabRestoreServiceClient(Profile* profile)
49 : profile_(profile) {} 50 : profile_(profile) {}
50 51
51 ChromeTabRestoreServiceClient::~ChromeTabRestoreServiceClient() {} 52 ChromeTabRestoreServiceClient::~ChromeTabRestoreServiceClient() {}
52 53
53 sessions::LiveTabContext* ChromeTabRestoreServiceClient::CreateLiveTabContext( 54 sessions::LiveTabContext* ChromeTabRestoreServiceClient::CreateLiveTabContext(
(...skipping 30 matching lines...) Expand all
84 } 85 }
85 86
86 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) { 87 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) {
87 return ::ShouldTrackURLForRestore(url); 88 return ::ShouldTrackURLForRestore(url);
88 } 89 }
89 90
90 std::string ChromeTabRestoreServiceClient::GetExtensionAppIDForTab( 91 std::string ChromeTabRestoreServiceClient::GetExtensionAppIDForTab(
91 sessions::LiveTab* tab) { 92 sessions::LiveTab* tab) {
92 std::string extension_app_id; 93 std::string extension_app_id;
93 94
94 #if defined(ENABLE_EXTENSIONS) 95 #if BUILDFLAG(ENABLE_EXTENSIONS)
95 extensions::TabHelper* extensions_tab_helper = 96 extensions::TabHelper* extensions_tab_helper =
96 extensions::TabHelper::FromWebContents( 97 extensions::TabHelper::FromWebContents(
97 static_cast<sessions::ContentLiveTab*>(tab)->web_contents()); 98 static_cast<sessions::ContentLiveTab*>(tab)->web_contents());
98 // extensions_tab_helper is NULL in some browser tests. 99 // extensions_tab_helper is NULL in some browser tests.
99 if (extensions_tab_helper) { 100 if (extensions_tab_helper) {
100 const extensions::Extension* extension = 101 const extensions::Extension* extension =
101 extensions_tab_helper->extension_app(); 102 extensions_tab_helper->extension_app();
102 if (extension) 103 if (extension)
103 extension_app_id = extension->id(); 104 extension_app_id = extension->id();
104 } 105 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 DCHECK(HasLastSession()); 144 DCHECK(HasLastSession());
144 #if BUILDFLAG(ENABLE_SESSION_SERVICE) 145 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
145 SessionServiceFactory::GetForProfile(profile_) 146 SessionServiceFactory::GetForProfile(profile_)
146 ->GetLastSession(callback, tracker); 147 ->GetLastSession(callback, tracker);
147 #endif 148 #endif
148 } 149 }
149 150
150 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { 151 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) {
151 RecordAppLaunch(profile_, url); 152 RecordAppLaunch(profile_, url);
152 } 153 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc ('k') | chrome/browser/sessions/session_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698