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

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

Issue 725853002: Move app launch metric recording code from NTP to chrome/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More mac Created 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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>
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/sessions/session_service.h" 28 #include "chrome/browser/sessions/session_service.h"
29 #include "chrome/browser/sessions/session_service_factory.h" 29 #include "chrome/browser/sessions/session_service_factory.h"
30 #include "chrome/browser/sessions/session_service_utils.h" 30 #include "chrome/browser/sessions/session_service_utils.h"
31 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_navigator.h" 33 #include "chrome/browser/ui/browser_navigator.h"
34 #include "chrome/browser/ui/browser_tabrestore.h" 34 #include "chrome/browser/ui/browser_tabrestore.h"
35 #include "chrome/browser/ui/browser_tabstrip.h" 35 #include "chrome/browser/ui/browser_tabstrip.h"
36 #include "chrome/browser/ui/browser_window.h" 36 #include "chrome/browser/ui/browser_window.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 37 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" 38 #include "chrome/common/extensions/extension_metrics.h"
39 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
40 #include "components/sessions/session_types.h" 40 #include "components/sessions/session_types.h"
41 #include "content/public/browser/child_process_security_policy.h" 41 #include "content/public/browser/child_process_security_policy.h"
42 #include "content/public/browser/dom_storage_context.h" 42 #include "content/public/browser/dom_storage_context.h"
43 #include "content/public/browser/navigation_controller.h" 43 #include "content/public/browser/navigation_controller.h"
44 #include "content/public/browser/notification_registrar.h" 44 #include "content/public/browser/notification_registrar.h"
45 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/render_process_host.h" 46 #include "content/public/browser/render_process_host.h"
47 #include "content/public/browser/render_widget_host.h" 47 #include "content/public/browser/render_widget_host.h"
48 #include "content/public/browser/render_widget_host_view.h" 48 #include "content/public/browser/render_widget_host_view.h"
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 void RecordAppLaunchForTab(Browser* browser, 973 void RecordAppLaunchForTab(Browser* browser,
974 const sessions::SessionTab& tab, 974 const sessions::SessionTab& tab,
975 int selected_index) { 975 int selected_index) {
976 DCHECK(selected_index >= 0 && 976 DCHECK(selected_index >= 0 &&
977 selected_index < static_cast<int>(tab.navigations.size())); 977 selected_index < static_cast<int>(tab.navigations.size()));
978 GURL url = tab.navigations[selected_index].virtual_url(); 978 GURL url = tab.navigations[selected_index].virtual_url();
979 const extensions::Extension* extension = 979 const extensions::Extension* extension =
980 extensions::ExtensionRegistry::Get(profile()) 980 extensions::ExtensionRegistry::Get(profile())
981 ->enabled_extensions().GetAppByURL(url); 981 ->enabled_extensions().GetAppByURL(url);
982 if (extension) { 982 if (extension) {
983 CoreAppLauncherHandler::RecordAppLaunchType( 983 extensions::RecordAppLaunchType(
984 extension_misc::APP_LAUNCH_SESSION_RESTORE, 984 extension_misc::APP_LAUNCH_SESSION_RESTORE,
985 extension->GetType()); 985 extension->GetType());
986 } 986 }
987 } 987 }
988 988
989 // Adds the tabs from |window| to |browser|. Normal tabs go after the existing 989 // Adds the tabs from |window| to |browser|. Normal tabs go after the existing
990 // tabs but pinned tabs will be pushed in front. 990 // tabs but pinned tabs will be pushed in front.
991 // If there are no existing tabs, the tab at |selected_tab_index| will be 991 // If there are no existing tabs, the tab at |selected_tab_index| will be
992 // selected. Otherwise, the tab selection will remain untouched. 992 // selected. Otherwise, the tab selection will remain untouched.
993 void RestoreTabsToBrowser(const sessions::SessionWindow& window, 993 void RestoreTabsToBrowser(const sessions::SessionWindow& window,
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 if (!active_session_restorers) 1322 if (!active_session_restorers)
1323 return false; 1323 return false;
1324 for (std::set<SessionRestoreImpl*>::const_iterator it = 1324 for (std::set<SessionRestoreImpl*>::const_iterator it =
1325 active_session_restorers->begin(); 1325 active_session_restorers->begin();
1326 it != active_session_restorers->end(); ++it) { 1326 it != active_session_restorers->end(); ++it) {
1327 if ((*it)->synchronous()) 1327 if ((*it)->synchronous())
1328 return true; 1328 return true;
1329 } 1329 }
1330 return false; 1330 return false;
1331 } 1331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698