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

Side by Side Diff: chrome/browser/sessions/chrome_tab_restore_service_client.cc

Issue 1345453002: Remove knowledge of extensions from TabRestoreServiceHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab_restore_service_delegate_static_methods
Patch Set: Rebase Created 5 years, 3 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 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 "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sessions/session_service.h" 8 #include "chrome/browser/sessions/session_service.h"
9 #include "chrome/browser/sessions/session_service_factory.h" 9 #include "chrome/browser/sessions/session_service_factory.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 12
13 #if defined(ENABLE_EXTENSIONS) 13 #if defined(ENABLE_EXTENSIONS)
14 #include "chrome/browser/extensions/tab_helper.h"
14 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
15 #include "chrome/common/extensions/extension_metrics.h" 16 #include "chrome/common/extensions/extension_metrics.h"
16 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
17 #include "extensions/common/extension.h" 18 #include "extensions/common/extension.h"
18 #include "extensions/common/extension_set.h" 19 #include "extensions/common/extension_set.h"
19 #endif 20 #endif
20 21
21 #if !defined(OS_ANDROID) 22 #if !defined(OS_ANDROID)
22 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" 23 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
23 #endif 24 #endif
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #else 84 #else
84 return BrowserTabRestoreServiceDelegate::FindDelegateWithID( 85 return BrowserTabRestoreServiceDelegate::FindDelegateWithID(
85 desired_id, static_cast<chrome::HostDesktopType>(host_desktop_type)); 86 desired_id, static_cast<chrome::HostDesktopType>(host_desktop_type));
86 #endif 87 #endif
87 } 88 }
88 89
89 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) { 90 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) {
90 return ::ShouldTrackURLForRestore(url); 91 return ::ShouldTrackURLForRestore(url);
91 } 92 }
92 93
94 std::string ChromeTabRestoreServiceClient::GetExtensionAppIDForWebContents(
95 content::WebContents* web_contents) {
96 std::string extension_app_id;
97
98 #if defined(ENABLE_EXTENSIONS)
99 extensions::TabHelper* extensions_tab_helper =
100 extensions::TabHelper::FromWebContents(web_contents);
101 // extensions_tab_helper is NULL in some browser tests.
102 if (extensions_tab_helper) {
103 const extensions::Extension* extension =
104 extensions_tab_helper->extension_app();
105 if (extension)
106 extension_app_id = extension->id();
107 }
108 #endif
109
110 return extension_app_id;
111 }
112
93 base::SequencedWorkerPool* ChromeTabRestoreServiceClient::GetBlockingPool() { 113 base::SequencedWorkerPool* ChromeTabRestoreServiceClient::GetBlockingPool() {
94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
95 return content::BrowserThread::GetBlockingPool(); 115 return content::BrowserThread::GetBlockingPool();
96 } 116 }
97 117
98 base::FilePath ChromeTabRestoreServiceClient::GetPathToSaveTo() { 118 base::FilePath ChromeTabRestoreServiceClient::GetPathToSaveTo() {
99 return profile_->GetPath(); 119 return profile_->GetPath();
100 } 120 }
101 121
102 GURL ChromeTabRestoreServiceClient::GetNewTabURL() { 122 GURL ChromeTabRestoreServiceClient::GetNewTabURL() {
(...skipping 23 matching lines...) Expand all
126 DCHECK(HasLastSession()); 146 DCHECK(HasLastSession());
127 #if defined(ENABLE_SESSION_SERVICE) 147 #if defined(ENABLE_SESSION_SERVICE)
128 SessionServiceFactory::GetForProfile(profile_) 148 SessionServiceFactory::GetForProfile(profile_)
129 ->GetLastSession(callback, tracker); 149 ->GetLastSession(callback, tracker);
130 #endif 150 #endif
131 } 151 }
132 152
133 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { 153 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) {
134 RecordAppLaunch(profile_, url); 154 RecordAppLaunch(profile_, url);
135 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/chrome_tab_restore_service_client.h ('k') | chrome/browser/sessions/tab_restore_service_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698