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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 158143002: Fine tuned availability of hotword plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 10 months 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 | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/ui/web_applications/web_app_ui.h" 28 #include "chrome/browser/ui/web_applications/web_app_ui.h"
29 #include "chrome/browser/web_applications/web_app.h" 29 #include "chrome/browser/web_applications/web_app.h"
30 #include "chrome/common/extensions/extension_constants.h" 30 #include "chrome/common/extensions/extension_constants.h"
31 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
32 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/page_navigator.h" 35 #include "content/public/browser/page_navigator.h"
36 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
37 #include "grit/theme_resources.h" 37 #include "grit/theme_resources.h"
38 #include "ui/app_list/app_list_switches.h"
39 #include "ui/app_list/app_list_view_delegate_observer.h" 38 #include "ui/app_list/app_list_view_delegate_observer.h"
40 #include "ui/app_list/search_box_model.h" 39 #include "ui/app_list/search_box_model.h"
41 #include "ui/app_list/speech_ui_model.h" 40 #include "ui/app_list/speech_ui_model.h"
42 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
43 42
44 #if defined(USE_ASH) 43 #if defined(USE_ASH)
45 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" 44 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h"
46 #endif 45 #endif
47 46
48 #if defined(OS_WIN) 47 #if defined(OS_WIN)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 88
90 AppListViewDelegate::AppListViewDelegate(Profile* profile, 89 AppListViewDelegate::AppListViewDelegate(Profile* profile,
91 AppListControllerDelegate* controller) 90 AppListControllerDelegate* controller)
92 : controller_(controller), 91 : controller_(controller),
93 profile_(profile), 92 profile_(profile),
94 model_(NULL) { 93 model_(NULL) {
95 CHECK(controller_); 94 CHECK(controller_);
96 RegisterForNotifications(); 95 RegisterForNotifications();
97 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); 96 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
98 97
99 // Hotword listening is on by default in ChromeOS right now. Here shouldn't 98 app_list::StartPageService* service =
100 // use the current state in the webui because it will be changed to 'hotword 99 app_list::StartPageService::Get(profile_);
101 // listening' state from 'ready' after the view is initialized.
102 speech_ui_.reset(new app_list::SpeechUIModel( 100 speech_ui_.reset(new app_list::SpeechUIModel(
103 #if defined(OS_CHROMEOS) 101 service ? service->state() : app_list::SPEECH_RECOGNITION_OFF));
104 app_list::switches::IsVoiceSearchEnabled() ?
105 app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING :
106 #endif
107 app_list::SPEECH_RECOGNITION_OFF));
108 102
109 #if defined(GOOGLE_CHROME_BUILD) 103 #if defined(GOOGLE_CHROME_BUILD)
110 speech_ui_->set_logo( 104 speech_ui_->set_logo(
111 *ui::ResourceBundle::GetSharedInstance(). 105 *ui::ResourceBundle::GetSharedInstance().
112 GetImageSkiaNamed(IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH)); 106 GetImageSkiaNamed(IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH));
113 #endif 107 #endif
114 108
115 OnProfileChanged(); // sets model_ 109 OnProfileChanged(); // sets model_
116 app_list::StartPageService* service =
117 app_list::StartPageService::Get(profile_);
118 if (service) 110 if (service)
119 service->AddObserver(this); 111 service->AddObserver(this);
120 } 112 }
121 113
122 AppListViewDelegate::~AppListViewDelegate() { 114 AppListViewDelegate::~AppListViewDelegate() {
123 app_list::StartPageService* service = 115 app_list::StartPageService* service =
124 app_list::StartPageService::Get(profile_); 116 app_list::StartPageService::Get(profile_);
125 if (service) 117 if (service)
126 service->RemoveObserver(this); 118 service->RemoveObserver(this);
127 g_browser_process-> 119 g_browser_process->
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 389
398 void AppListViewDelegate::AddObserver( 390 void AppListViewDelegate::AddObserver(
399 app_list::AppListViewDelegateObserver* observer) { 391 app_list::AppListViewDelegateObserver* observer) {
400 observers_.AddObserver(observer); 392 observers_.AddObserver(observer);
401 } 393 }
402 394
403 void AppListViewDelegate::RemoveObserver( 395 void AppListViewDelegate::RemoveObserver(
404 app_list::AppListViewDelegateObserver* observer) { 396 app_list::AppListViewDelegateObserver* observer) {
405 observers_.RemoveObserver(observer); 397 observers_.RemoveObserver(observer);
406 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698