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 "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/metrics/user_metrics.h" | 12 #include "base/metrics/user_metrics.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | |
| 16 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/search/hotword_service.h" | 19 #include "chrome/browser/search/hotword_service.h" |
| 19 #include "chrome/browser/search/hotword_service_factory.h" | 20 #include "chrome/browser/search/hotword_service_factory.h" |
| 20 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 21 #include "chrome/browser/ui/app_list/app_list_service.h" | 22 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 22 #include "chrome/browser/ui/app_list/app_list_syncable_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_factory.h" | 24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 24 #include "chrome/browser/ui/app_list/search/search_controller.h" | 25 #include "chrome/browser/ui/app_list/search/search_controller.h" |
| 25 #include "chrome/browser/ui/app_list/start_page_service.h" | 26 #include "chrome/browser/ui/app_list/start_page_service.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 if (app_list::switches::IsExperimentalAppListEnabled() && | 158 if (app_list::switches::IsExperimentalAppListEnabled() && |
| 158 command_line->HasSwitch(switches::kCustomLauncherPage)) { | 159 command_line->HasSwitch(switches::kCustomLauncherPage)) { |
| 159 GURL custom_launcher_page_url( | 160 GURL custom_launcher_page_url( |
| 160 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage)); | 161 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage)); |
| 161 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { | 162 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { |
| 162 LOG(ERROR) << "Invalid custom launcher page URL: " | 163 LOG(ERROR) << "Invalid custom launcher page URL: " |
| 163 << custom_launcher_page_url.possibly_invalid_spec(); | 164 << custom_launcher_page_url.possibly_invalid_spec(); |
| 164 } else { | 165 } else { |
| 165 content::WebContents::CreateParams params(profile_); | 166 content::WebContents::CreateParams params(profile_); |
| 166 custom_page_web_contents_.reset(content::WebContents::Create(params)); | 167 custom_page_web_contents_.reset(content::WebContents::Create(params)); |
| 168 // This observer will activate the extension when it is navigated to, | |
| 169 // which allows Dispatcher to give it the proper context. | |
|
not at google - send to devlin
2014/07/07 14:50:10
creating a [Chrome]ExtensionWebContentsObserver do
Matt Giuca
2014/07/09 15:05:30
Done.
| |
| 170 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | |
| 171 custom_page_web_contents_.get()); | |
| 167 custom_page_web_contents_->GetController().LoadURL( | 172 custom_page_web_contents_->GetController().LoadURL( |
| 168 custom_launcher_page_url, | 173 custom_launcher_page_url, |
| 169 content::Referrer(), | 174 content::Referrer(), |
| 170 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 175 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 171 std::string()); | 176 std::string()); |
| 172 } | 177 } |
| 173 } | 178 } |
| 174 } | 179 } |
| 175 | 180 |
| 176 AppListViewDelegate::~AppListViewDelegate() { | 181 AppListViewDelegate::~AppListViewDelegate() { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 538 |
| 534 void AppListViewDelegate::AddObserver( | 539 void AppListViewDelegate::AddObserver( |
| 535 app_list::AppListViewDelegateObserver* observer) { | 540 app_list::AppListViewDelegateObserver* observer) { |
| 536 observers_.AddObserver(observer); | 541 observers_.AddObserver(observer); |
| 537 } | 542 } |
| 538 | 543 |
| 539 void AppListViewDelegate::RemoveObserver( | 544 void AppListViewDelegate::RemoveObserver( |
| 540 app_list::AppListViewDelegateObserver* observer) { | 545 app_list::AppListViewDelegateObserver* observer) { |
| 541 observers_.RemoveObserver(observer); | 546 observers_.RemoveObserver(observer); |
| 542 } | 547 } |
| OLD | NEW |