Chromium Code Reviews| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "apps/custom_launcher_page_contents.h" | 9 #include "apps/custom_launcher_page_contents.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/metrics/user_metrics.h" | 13 #include "base/metrics/user_metrics.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/search/hotword_service.h" | 19 #include "chrome/browser/search/hotword_service.h" |
| 20 #include "chrome/browser/search/hotword_service_factory.h" | 20 #include "chrome/browser/search/hotword_service_factory.h" |
| 21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 22 #include "chrome/browser/ui/app_list/app_list_service.h" | 22 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 23 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 23 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 25 #include "chrome/browser/ui/app_list/search/search_controller.h" | 25 #include "chrome/browser/ui/app_list/search/search_controller.h" |
| 26 #include "chrome/browser/ui/app_list/start_page_service.h" | 26 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 27 #include "chrome/browser/ui/apps/chrome_app_window_delegate.h" | |
|
benwells
2014/08/04 02:35:20
I assume this is part of the 'rebase might be need
Matt Giuca
2014/08/04 06:25:58
Indeed.
| |
| 27 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/chrome_pages.h" | 29 #include "chrome/browser/ui/chrome_pages.h" |
| 29 #include "chrome/browser/ui/host_desktop.h" | 30 #include "chrome/browser/ui/host_desktop.h" |
| 30 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 31 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 31 #include "chrome/browser/web_applications/web_app.h" | 32 #include "chrome/browser/web_applications/web_app.h" |
| 32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/extensions/extension_constants.h" | 34 #include "chrome/common/extensions/extension_constants.h" |
| 34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 35 #include "components/signin/core/browser/signin_manager.h" | 36 #include "components/signin/core/browser/signin_manager.h" |
| 36 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 // arbitrary extensions may be able to specify their own custom pages. | 157 // arbitrary extensions may be able to specify their own custom pages. |
| 157 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 158 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 158 if (app_list::switches::IsExperimentalAppListEnabled() && | 159 if (app_list::switches::IsExperimentalAppListEnabled() && |
| 159 command_line->HasSwitch(switches::kCustomLauncherPage)) { | 160 command_line->HasSwitch(switches::kCustomLauncherPage)) { |
| 160 GURL custom_launcher_page_url( | 161 GURL custom_launcher_page_url( |
| 161 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage)); | 162 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage)); |
| 162 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { | 163 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { |
| 163 LOG(ERROR) << "Invalid custom launcher page URL: " | 164 LOG(ERROR) << "Invalid custom launcher page URL: " |
| 164 << custom_launcher_page_url.possibly_invalid_spec(); | 165 << custom_launcher_page_url.possibly_invalid_spec(); |
| 165 } else { | 166 } else { |
| 166 custom_page_contents_.reset(new apps::CustomLauncherPageContents()); | 167 std::string extension_id = custom_launcher_page_url.host(); |
| 168 custom_page_contents_.reset(new apps::CustomLauncherPageContents( | |
| 169 new ChromeAppDelegate, extension_id)); | |
| 167 custom_page_contents_->Initialize(profile, custom_launcher_page_url); | 170 custom_page_contents_->Initialize(profile, custom_launcher_page_url); |
| 168 } | 171 } |
| 169 } | 172 } |
| 170 } | 173 } |
| 171 | 174 |
| 172 AppListViewDelegate::~AppListViewDelegate() { | 175 AppListViewDelegate::~AppListViewDelegate() { |
| 173 app_list::StartPageService* service = | 176 app_list::StartPageService* service = |
| 174 app_list::StartPageService::Get(profile_); | 177 app_list::StartPageService::Get(profile_); |
| 175 if (service) | 178 if (service) |
| 176 service->RemoveObserver(this); | 179 service->RemoveObserver(this); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 536 |
| 534 void AppListViewDelegate::AddObserver( | 537 void AppListViewDelegate::AddObserver( |
| 535 app_list::AppListViewDelegateObserver* observer) { | 538 app_list::AppListViewDelegateObserver* observer) { |
| 536 observers_.AddObserver(observer); | 539 observers_.AddObserver(observer); |
| 537 } | 540 } |
| 538 | 541 |
| 539 void AppListViewDelegate::RemoveObserver( | 542 void AppListViewDelegate::RemoveObserver( |
| 540 app_list::AppListViewDelegateObserver* observer) { | 543 app_list::AppListViewDelegateObserver* observer) { |
| 541 observers_.RemoveObserver(observer); | 544 observers_.RemoveObserver(observer); |
| 542 } | 545 } |
| OLD | NEW |