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

Side by Side Diff: chrome/browser/sessions/session_restore.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/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/platform_file.h" 19 #include "base/platform_file.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/task/cancelable_task_tracker.h" 22 #include "base/task/cancelable_task_tracker.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/browser/performance_monitor/startup_timer.h" 25 #include "chrome/browser/performance_monitor/startup_timer.h"
27 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/sessions/session_service.h" 27 #include "chrome/browser/sessions/session_service.h"
29 #include "chrome/browser/sessions/session_service_factory.h" 28 #include "chrome/browser/sessions/session_service_factory.h"
30 #include "chrome/browser/sessions/session_types.h" 29 #include "chrome/browser/sessions/session_types.h"
31 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_finder.h" 31 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_navigator.h" 32 #include "chrome/browser/ui/browser_navigator.h"
34 #include "chrome/browser/ui/browser_tabrestore.h" 33 #include "chrome/browser/ui/browser_tabrestore.h"
35 #include "chrome/browser/ui/browser_tabstrip.h" 34 #include "chrome/browser/ui/browser_tabstrip.h"
36 #include "chrome/browser/ui/browser_window.h" 35 #include "chrome/browser/ui/browser_window.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" 37 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
39 #include "content/public/browser/child_process_security_policy.h" 38 #include "content/public/browser/child_process_security_policy.h"
40 #include "content/public/browser/dom_storage_context.h" 39 #include "content/public/browser/dom_storage_context.h"
41 #include "content/public/browser/navigation_controller.h" 40 #include "content/public/browser/navigation_controller.h"
42 #include "content/public/browser/notification_registrar.h" 41 #include "content/public/browser/notification_registrar.h"
43 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/render_process_host.h" 43 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_widget_host.h" 44 #include "content/public/browser/render_widget_host.h"
46 #include "content/public/browser/render_widget_host_view.h" 45 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/session_storage_namespace.h" 46 #include "content/public/browser/session_storage_namespace.h"
48 #include "content/public/browser/storage_partition.h" 47 #include "content/public/browser/storage_partition.h"
49 #include "content/public/browser/web_contents.h" 48 #include "content/public/browser/web_contents.h"
50 #include "content/public/browser/web_contents_view.h" 49 #include "content/public/browser/web_contents_view.h"
50 #include "extensions/browser/extension_registry.h"
51 #include "extensions/common/extension_set.h"
51 #include "net/base/network_change_notifier.h" 52 #include "net/base/network_change_notifier.h"
52 53
53 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
54 #include "chrome/browser/chromeos/boot_times_loader.h" 55 #include "chrome/browser/chromeos/boot_times_loader.h"
55 #endif 56 #endif
56 57
57 #if defined(OS_WIN) 58 #if defined(OS_WIN)
58 #include "win8/util/win8_util.h" 59 #include "win8/util/win8_util.h"
59 #endif 60 #endif
60 61
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 944
944 // Record an app launch event (if appropriate) for a tab which is about to 945 // Record an app launch event (if appropriate) for a tab which is about to
945 // be restored. Callers should ensure that selected_index is within the 946 // be restored. Callers should ensure that selected_index is within the
946 // bounds of tab.navigations before calling. 947 // bounds of tab.navigations before calling.
947 void RecordAppLaunchForTab(Browser* browser, 948 void RecordAppLaunchForTab(Browser* browser,
948 const SessionTab& tab, 949 const SessionTab& tab,
949 int selected_index) { 950 int selected_index) {
950 DCHECK(selected_index >= 0 && 951 DCHECK(selected_index >= 0 &&
951 selected_index < static_cast<int>(tab.navigations.size())); 952 selected_index < static_cast<int>(tab.navigations.size()));
952 GURL url = tab.navigations[selected_index].virtual_url(); 953 GURL url = tab.navigations[selected_index].virtual_url();
953 if (browser->profile()->GetExtensionService()) { 954 const extensions::Extension* extension =
954 const extensions::Extension* extension = 955 extensions::ExtensionRegistry::Get(profile())
955 browser->profile()->GetExtensionService()->GetInstalledApp(url); 956 ->enabled_extensions().GetAppByURL(url);
956 if (extension) { 957 if (extension) {
957 CoreAppLauncherHandler::RecordAppLaunchType( 958 CoreAppLauncherHandler::RecordAppLaunchType(
958 extension_misc::APP_LAUNCH_SESSION_RESTORE, 959 extension_misc::APP_LAUNCH_SESSION_RESTORE,
959 extension->GetType()); 960 extension->GetType());
960 }
961 } 961 }
962 } 962 }
963 963
964 // Adds the tabs from |window| to |browser|. Normal tabs go after the existing 964 // Adds the tabs from |window| to |browser|. Normal tabs go after the existing
965 // tabs but pinned tabs will be pushed in front. 965 // tabs but pinned tabs will be pushed in front.
966 // If there are no existing tabs, the tab at |selected_tab_index| will be 966 // If there are no existing tabs, the tab at |selected_tab_index| will be
967 // selected. Otherwise, the tab selection will remain untouched. 967 // selected. Otherwise, the tab selection will remain untouched.
968 void RestoreTabsToBrowser(const SessionWindow& window, 968 void RestoreTabsToBrowser(const SessionWindow& window,
969 Browser* browser, 969 Browser* browser,
970 int initial_tab_count, 970 int initial_tab_count,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 if (!active_session_restorers) 1255 if (!active_session_restorers)
1256 return false; 1256 return false;
1257 for (std::set<SessionRestoreImpl*>::const_iterator it = 1257 for (std::set<SessionRestoreImpl*>::const_iterator it =
1258 active_session_restorers->begin(); 1258 active_session_restorers->begin();
1259 it != active_session_restorers->end(); ++it) { 1259 it != active_session_restorers->end(); ++it) {
1260 if ((*it)->synchronous()) 1260 if ((*it)->synchronous())
1261 return true; 1261 return true;
1262 } 1262 }
1263 return false; 1263 return false;
1264 } 1264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698