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/apps/scoped_keep_alive.h" |
15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/profiles/profile_info_cache.h" | 18 #include "chrome/browser/profiles/profile_info_cache.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/search/hotword_service.h" | 20 #include "chrome/browser/search/hotword_service.h" |
20 #include "chrome/browser/search/hotword_service_factory.h" | 21 #include "chrome/browser/search/hotword_service_factory.h" |
21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 22 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
22 #include "chrome/browser/ui/app_list/app_list_service.h" | 23 #include "chrome/browser/ui/app_list/app_list_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.h" |
24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 25 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 void AppListViewDelegate::SetUpCustomLauncherPages() { | 281 void AppListViewDelegate::SetUpCustomLauncherPages() { |
281 std::vector<GURL> custom_launcher_page_urls; | 282 std::vector<GURL> custom_launcher_page_urls; |
282 GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls); | 283 GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls); |
283 for (std::vector<GURL>::const_iterator it = custom_launcher_page_urls.begin(); | 284 for (std::vector<GURL>::const_iterator it = custom_launcher_page_urls.begin(); |
284 it != custom_launcher_page_urls.end(); | 285 it != custom_launcher_page_urls.end(); |
285 ++it) { | 286 ++it) { |
286 std::string extension_id = it->host(); | 287 std::string extension_id = it->host(); |
287 apps::CustomLauncherPageContents* page_contents = | 288 apps::CustomLauncherPageContents* page_contents = |
288 new apps::CustomLauncherPageContents( | 289 new apps::CustomLauncherPageContents( |
289 scoped_ptr<extensions::AppDelegate>(new ChromeAppDelegate), | 290 scoped_ptr<extensions::AppDelegate>( |
| 291 new ChromeAppDelegate(scoped_ptr<ScopedKeepAlive>())), |
290 extension_id); | 292 extension_id); |
291 page_contents->Initialize(profile_, *it); | 293 page_contents->Initialize(profile_, *it); |
292 custom_page_contents_.push_back(page_contents); | 294 custom_page_contents_.push_back(page_contents); |
293 } | 295 } |
294 } | 296 } |
295 | 297 |
296 void AppListViewDelegate::OnHotwordStateChanged(bool started) { | 298 void AppListViewDelegate::OnHotwordStateChanged(bool started) { |
297 if (started) { | 299 if (started) { |
298 if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_READY) { | 300 if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_READY) { |
299 OnSpeechRecognitionStateChanged( | 301 OnSpeechRecognitionStateChanged( |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 652 |
651 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 653 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
652 // its destructor will check that it has no remaining observers. | 654 // its destructor will check that it has no remaining observers. |
653 scoped_observer_.RemoveAll(); | 655 scoped_observer_.RemoveAll(); |
654 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 656 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
655 break; | 657 break; |
656 default: | 658 default: |
657 NOTREACHED(); | 659 NOTREACHED(); |
658 } | 660 } |
659 } | 661 } |
OLD | NEW |