OLD | NEW |
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/app_list/app_list_view_delegate.h" | 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "apps/custom_launcher_page_contents.h" | |
12 #include "base/callback.h" | 11 #include "base/callback.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
15 #include "base/metrics/user_metrics.h" | 14 #include "base/metrics/user_metrics.h" |
16 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
17 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
18 #include "build/build_config.h" | 17 #include "build/build_config.h" |
19 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 20 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
22 #include "chrome/browser/profiles/profile_attributes_entry.h" | 21 #include "chrome/browser/profiles/profile_attributes_entry.h" |
23 #include "chrome/browser/profiles/profile_attributes_storage.h" | 22 #include "chrome/browser/profiles/profile_attributes_storage.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/search/hotword_service.h" | 24 #include "chrome/browser/search/hotword_service.h" |
26 #include "chrome/browser/search/hotword_service_factory.h" | 25 #include "chrome/browser/search/hotword_service_factory.h" |
27 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
28 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 27 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
29 #include "chrome/browser/ui/app_list/app_list_service.h" | 28 #include "chrome/browser/ui/app_list/app_list_service.h" |
30 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 29 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
31 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 30 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 31 #include "chrome/browser/ui/app_list/custom_launcher_page_contents.h" |
32 #include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h" | 32 #include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h" |
33 #include "chrome/browser/ui/app_list/search/search_controller_factory.h" | 33 #include "chrome/browser/ui/app_list/search/search_controller_factory.h" |
34 #include "chrome/browser/ui/app_list/search/search_resource_manager.h" | 34 #include "chrome/browser/ui/app_list/search/search_resource_manager.h" |
35 #include "chrome/browser/ui/app_list/start_page_service.h" | 35 #include "chrome/browser/ui/app_list/start_page_service.h" |
36 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 36 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
37 #include "chrome/browser/ui/browser_finder.h" | 37 #include "chrome/browser/ui/browser_finder.h" |
38 #include "chrome/browser/ui/chrome_pages.h" | 38 #include "chrome/browser/ui/chrome_pages.h" |
39 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 39 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
40 #include "chrome/browser/web_applications/web_app.h" | 40 #include "chrome/browser/web_applications/web_app.h" |
41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 void AppListViewDelegate::SetUpCustomLauncherPages() { | 310 void AppListViewDelegate::SetUpCustomLauncherPages() { |
311 std::vector<GURL> custom_launcher_page_urls; | 311 std::vector<GURL> custom_launcher_page_urls; |
312 GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls); | 312 GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls); |
313 if (custom_launcher_page_urls.empty()) | 313 if (custom_launcher_page_urls.empty()) |
314 return; | 314 return; |
315 | 315 |
316 for (auto it = custom_launcher_page_urls.begin(); | 316 for (auto it = custom_launcher_page_urls.begin(); |
317 it != custom_launcher_page_urls.end(); ++it) { | 317 it != custom_launcher_page_urls.end(); ++it) { |
318 std::string extension_id = it->host(); | 318 std::string extension_id = it->host(); |
319 auto page_contents = base::MakeUnique<apps::CustomLauncherPageContents>( | 319 auto page_contents = base::MakeUnique<app_list::CustomLauncherPageContents>( |
320 base::MakeUnique<ChromeAppDelegate>(false), extension_id); | 320 base::MakeUnique<ChromeAppDelegate>(false), extension_id); |
321 page_contents->Initialize(profile_, *it); | 321 page_contents->Initialize(profile_, *it); |
322 custom_page_contents_.push_back(std::move(page_contents)); | 322 custom_page_contents_.push_back(std::move(page_contents)); |
323 } | 323 } |
324 | 324 |
325 std::string first_launcher_page_app_id = custom_launcher_page_urls[0].host(); | 325 std::string first_launcher_page_app_id = custom_launcher_page_urls[0].host(); |
326 const extensions::Extension* extension = | 326 const extensions::Extension* extension = |
327 extensions::ExtensionRegistry::Get(profile_) | 327 extensions::ExtensionRegistry::Get(profile_) |
328 ->GetExtensionById(first_launcher_page_app_id, | 328 ->GetExtensionById(first_launcher_page_app_id, |
329 extensions::ExtensionRegistry::EVERYTHING); | 329 extensions::ExtensionRegistry::EVERYTHING); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 const content::NotificationDetails& details) { | 702 const content::NotificationDetails& details) { |
703 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 703 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
704 | 704 |
705 SetProfile(nullptr); // Ensures launcher page web contents are torn down. | 705 SetProfile(nullptr); // Ensures launcher page web contents are torn down. |
706 | 706 |
707 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 707 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
708 // its destructor will check that it has no remaining observers. | 708 // its destructor will check that it has no remaining observers. |
709 scoped_observer_.RemoveAll(); | 709 scoped_observer_.RemoveAll(); |
710 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 710 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
711 } | 711 } |
OLD | NEW |