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

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

Issue 55433002: Propagates the search result of start page to the app-list search box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Profile* profile) 82 Profile* profile)
83 : controller_(controller.Pass()), 83 : controller_(controller.Pass()),
84 profile_(profile), 84 profile_(profile),
85 model_(NULL) { 85 model_(NULL) {
86 CHECK(controller_); 86 CHECK(controller_);
87 RegisterForNotifications(); 87 RegisterForNotifications();
88 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); 88 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
89 } 89 }
90 90
91 AppListViewDelegate::~AppListViewDelegate() { 91 AppListViewDelegate::~AppListViewDelegate() {
92 app_list::StartPageService* service =
93 app_list::StartPageService::Get(profile_);
94 if (service)
95 service->SetAppListModel(NULL);
92 g_browser_process-> 96 g_browser_process->
93 profile_manager()->GetProfileInfoCache().RemoveObserver(this); 97 profile_manager()->GetProfileInfoCache().RemoveObserver(this);
94 } 98 }
95 99
96 void AppListViewDelegate::RegisterForNotifications() { 100 void AppListViewDelegate::RegisterForNotifications() {
97 registrar_.RemoveAll(); 101 registrar_.RemoveAll();
98 DCHECK(profile_); 102 DCHECK(profile_);
99 103
100 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 104 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
101 content::NotificationService::AllSources()); 105 content::NotificationService::AllSources());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void AppListViewDelegate::InitModel(app_list::AppListModel* model) { 156 void AppListViewDelegate::InitModel(app_list::AppListModel* model) {
153 DCHECK(!model_); 157 DCHECK(!model_);
154 DCHECK(model); 158 DCHECK(model);
155 model_ = model; 159 model_ = model;
156 160
157 // Initialize apps model. 161 // Initialize apps model.
158 apps_builder_.reset(new ExtensionAppModelBuilder(profile_, 162 apps_builder_.reset(new ExtensionAppModelBuilder(profile_,
159 model, 163 model,
160 controller_.get())); 164 controller_.get()));
161 165
166 app_list::StartPageService* service =
167 app_list::StartPageService::Get(profile_);
168 if (service)
169 service->SetAppListModel(model_);
170
162 // Initialize the profile information in the app list menu. 171 // Initialize the profile information in the app list menu.
163 OnProfileChanged(); 172 OnProfileChanged();
164 } 173 }
165 174
166 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { 175 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() {
167 return &signin_delegate_; 176 return &signin_delegate_;
168 } 177 }
169 178
170 void AppListViewDelegate::GetShortcutPathForApp( 179 void AppListViewDelegate::GetShortcutPathForApp(
171 const std::string& app_id, 180 const std::string& app_id,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 298 }
290 299
291 content::WebContents* AppListViewDelegate::GetStartPageContents() { 300 content::WebContents* AppListViewDelegate::GetStartPageContents() {
292 app_list::StartPageService* service = 301 app_list::StartPageService* service =
293 app_list::StartPageService::Get(profile_); 302 app_list::StartPageService::Get(profile_);
294 if (!service) 303 if (!service)
295 return NULL; 304 return NULL;
296 305
297 return service->contents(); 306 return service->contents();
298 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698