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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 218683011: Remove ExtensionService::[Get|Is]InstalledApp() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ces_get_installed_ext_by_url
Patch Set: Latest master Created 6 years, 8 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 (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/ui/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_restore_service.h" 10 #include "apps/app_restore_service.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "content/public/browser/dom_storage_context.h" 84 #include "content/public/browser/dom_storage_context.h"
85 #include "content/public/browser/notification_observer.h" 85 #include "content/public/browser/notification_observer.h"
86 #include "content/public/browser/notification_registrar.h" 86 #include "content/public/browser/notification_registrar.h"
87 #include "content/public/browser/storage_partition.h" 87 #include "content/public/browser/storage_partition.h"
88 #include "content/public/browser/web_contents.h" 88 #include "content/public/browser/web_contents.h"
89 #include "content/public/browser/web_contents_view.h" 89 #include "content/public/browser/web_contents_view.h"
90 #include "extensions/browser/extension_prefs.h" 90 #include "extensions/browser/extension_prefs.h"
91 #include "extensions/browser/extension_registry.h" 91 #include "extensions/browser/extension_registry.h"
92 #include "extensions/browser/extension_system.h" 92 #include "extensions/browser/extension_system.h"
93 #include "extensions/common/constants.h" 93 #include "extensions/common/constants.h"
94 #include "extensions/common/extension.h"
95 #include "extensions/common/extension_set.h"
94 #include "grit/locale_settings.h" 96 #include "grit/locale_settings.h"
95 #include "ui/base/l10n/l10n_util.h" 97 #include "ui/base/l10n/l10n_util.h"
96 #include "ui/base/resource/resource_bundle.h" 98 #include "ui/base/resource/resource_bundle.h"
97 99
98 #if defined(OS_MACOSX) 100 #if defined(OS_MACOSX)
99 #include "base/mac/mac_util.h" 101 #include "base/mac/mac_util.h"
100 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h" 102 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h"
101 #endif 103 #endif
102 104
103 #if defined(TOOLKIT_GTK) 105 #if defined(TOOLKIT_GTK)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 222
221 void RecordCmdLineAppHistogram(extensions::Manifest::Type app_type) { 223 void RecordCmdLineAppHistogram(extensions::Manifest::Type app_type) {
222 CoreAppLauncherHandler::RecordAppLaunchType( 224 CoreAppLauncherHandler::RecordAppLaunchType(
223 extension_misc::APP_LAUNCH_CMD_LINE_APP, 225 extension_misc::APP_LAUNCH_CMD_LINE_APP,
224 app_type); 226 app_type);
225 } 227 }
226 228
227 void RecordAppLaunches(Profile* profile, 229 void RecordAppLaunches(Profile* profile,
228 const std::vector<GURL>& cmd_line_urls, 230 const std::vector<GURL>& cmd_line_urls,
229 StartupTabs& autolaunch_tabs) { 231 StartupTabs& autolaunch_tabs) {
230 ExtensionService* extension_service = profile->GetExtensionService(); 232 const extensions::ExtensionSet& extensions =
231 DCHECK(extension_service); 233 extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
232 for (size_t i = 0; i < cmd_line_urls.size(); ++i) { 234 for (size_t i = 0; i < cmd_line_urls.size(); ++i) {
233 const extensions::Extension* extension = 235 const extensions::Extension* extension =
234 extension_service->GetInstalledApp(cmd_line_urls.at(i)); 236 extensions.GetAppByURL(cmd_line_urls.at(i));
235 if (extension) { 237 if (extension) {
236 CoreAppLauncherHandler::RecordAppLaunchType( 238 CoreAppLauncherHandler::RecordAppLaunchType(
237 extension_misc::APP_LAUNCH_CMD_LINE_URL, 239 extension_misc::APP_LAUNCH_CMD_LINE_URL,
238 extension->GetType()); 240 extension->GetType());
239 } 241 }
240 } 242 }
241 for (size_t i = 0; i < autolaunch_tabs.size(); ++i) { 243 for (size_t i = 0; i < autolaunch_tabs.size(); ++i) {
242 const extensions::Extension* extension = 244 const extensions::Extension* extension =
243 extension_service->GetInstalledApp(autolaunch_tabs.at(i).url); 245 extensions.GetAppByURL(cmd_line_urls.at(i));
244 if (extension) { 246 if (extension) {
245 CoreAppLauncherHandler::RecordAppLaunchType( 247 CoreAppLauncherHandler::RecordAppLaunchType(
246 extension_misc::APP_LAUNCH_AUTOLAUNCH, 248 extension_misc::APP_LAUNCH_AUTOLAUNCH,
247 extension->GetType()); 249 extension->GetType());
248 } 250 }
249 } 251 }
250 } 252 }
251 253
252 bool IsNewTabURL(Profile* profile, const GURL& url) { 254 bool IsNewTabURL(Profile* profile, const GURL& url) {
253 GURL ntp_url(chrome::kChromeUINewTabURL); 255 GURL ntp_url(chrome::kChromeUINewTabURL);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 #endif 502 #endif
501 GURL url(url_string); 503 GURL url(url_string);
502 504
503 // Restrict allowed URLs for --app switch. 505 // Restrict allowed URLs for --app switch.
504 if (!url.is_empty() && url.is_valid()) { 506 if (!url.is_empty() && url.is_valid()) {
505 ChildProcessSecurityPolicy* policy = 507 ChildProcessSecurityPolicy* policy =
506 ChildProcessSecurityPolicy::GetInstance(); 508 ChildProcessSecurityPolicy::GetInstance();
507 if (policy->IsWebSafeScheme(url.scheme()) || 509 if (policy->IsWebSafeScheme(url.scheme()) ||
508 url.SchemeIs(content::kFileScheme)) { 510 url.SchemeIs(content::kFileScheme)) {
509 const extensions::Extension* extension = 511 const extensions::Extension* extension =
510 profile->GetExtensionService()->GetInstalledApp(url); 512 extensions::ExtensionRegistry::Get(profile)
513 ->enabled_extensions().GetAppByURL(url);
511 if (extension) { 514 if (extension) {
512 RecordCmdLineAppHistogram(extension->GetType()); 515 RecordCmdLineAppHistogram(extension->GetType());
513 } else { 516 } else {
514 CoreAppLauncherHandler::RecordAppLaunchType( 517 CoreAppLauncherHandler::RecordAppLaunchType(
515 extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY, 518 extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY,
516 extensions::Manifest::TYPE_HOSTED_APP); 519 extensions::Manifest::TYPE_HOSTED_APP);
517 } 520 }
518 521
519 WebContents* app_tab = OpenAppShortcutWindow(profile, url); 522 WebContents* app_tab = OpenAppShortcutWindow(profile, url);
520 523
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 } 948 }
946 949
947 #if !defined(OS_WIN) 950 #if !defined(OS_WIN)
948 // static 951 // static
949 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( 952 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
950 Profile* profile, 953 Profile* profile,
951 const std::vector<GURL>& startup_urls) { 954 const std::vector<GURL>& startup_urls) {
952 return false; 955 return false;
953 } 956 }
954 #endif 957 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698