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

Side by Side Diff: chrome/browser/ui/views/search_view_controller.cc

Issue 10910232: SearchViewController needs more tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling Created 8 years, 3 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/views/search_view_controller.h" 5 #include "chrome/browser/ui/views/search_view_controller.h"
6 6
7 #include "chrome/browser/instant/instant_controller.h" 7 #include "chrome/browser/instant/instant_controller.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/search_engines/search_engine_type.h" 9 #include "chrome/browser/search_engines/search_engine_type.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
11 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 11 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
12 #include "chrome/browser/search_engines/template_url_service.h" 12 #include "chrome/browser/search_engines/template_url_service.h"
13 #include "chrome/browser/search_engines/template_url_service_factory.h" 13 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "chrome/browser/ui/search/search_model.h" 14 #include "chrome/browser/ui/search/search_model.h"
15 #include "chrome/browser/ui/search/search_tab_helper.h" 15 #include "chrome/browser/ui/search/search_tab_helper.h"
16 #include "chrome/browser/ui/search/search_types.h" 16 #include "chrome/browser/ui/search/search_types.h"
17 #include "chrome/browser/ui/search/search_ui.h" 17 #include "chrome/browser/ui/search/search_ui.h"
18 #include "chrome/browser/ui/search/toolbar_search_animator.h" 18 #include "chrome/browser/ui/search/toolbar_search_animator.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
20 #include "chrome/browser/ui/views/frame/contents_container.h" 20 #include "chrome/browser/ui/views/frame/contents_container.h"
21 #include "chrome/browser/ui/views/location_bar/location_bar_container.h" 21 #include "chrome/browser/ui/views/location_bar/location_bar_container.h"
22 #include "chrome/browser/ui/views/toolbar_view.h" 22 #include "chrome/browser/ui/views/toolbar_view.h"
23 #include "chrome/browser/ui/webui/instant_ui.h" 23 #include "chrome/browser/ui/webui/instant_ui.h"
24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/notification_service.h"
25 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
26 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/compositor/layer.h" 29 #include "ui/compositor/layer.h"
28 #include "ui/compositor/scoped_layer_animation_settings.h" 30 #include "ui/compositor/scoped_layer_animation_settings.h"
29 #include "ui/gfx/canvas.h" 31 #include "ui/gfx/canvas.h"
30 #include "ui/views/controls/image_view.h" 32 #include "ui/views/controls/image_view.h"
31 #include "ui/views/controls/label.h" 33 #include "ui/views/controls/label.h"
32 #include "ui/views/controls/webview/webview.h" 34 #include "ui/views/controls/webview/webview.h"
33 #include "ui/views/layout/fill_layout.h" 35 #include "ui/views/layout/fill_layout.h"
34 #include "ui/views/layout/layout_manager.h" 36 #include "ui/views/layout/layout_manager.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 ntp_container_->SetVisible(false); 328 ntp_container_->SetVisible(false);
327 MaybeHideOverlay(); 329 MaybeHideOverlay();
328 // While |ntp_container_| was fading out, location bar was animating from the 330 // While |ntp_container_| was fading out, location bar was animating from the
329 // middle of the NTP page to the top toolbar, at the same rate. 331 // middle of the NTP page to the top toolbar, at the same rate.
330 // Suggestions need to be aligned with the final location of the location bar. 332 // Suggestions need to be aligned with the final location of the location bar.
331 // So if omnibox popup view (InlineOmniboxPopupView) is visible, force a 333 // So if omnibox popup view (InlineOmniboxPopupView) is visible, force a
332 // re-layout of its children (i.e. the suggestions) to align with the location 334 // re-layout of its children (i.e. the suggestions) to align with the location
333 // bar's final bounds. 335 // bar's final bounds.
334 if (omnibox_popup_parent_->is_child_visible()) 336 if (omnibox_popup_parent_->is_child_visible())
335 omnibox_popup_parent_->child_at(0)->Layout(); 337 omnibox_popup_parent_->child_at(0)->Layout();
338
339 content::NotificationService::current()->Notify(
340 chrome::NOTIFICATION_SEARCH_VIEW_CONTROLLER_ANIMATION_FINISHED,
341 content::Source<SearchViewController>(this),
342 content::NotificationService::NoDetails());
336 } 343 }
337 344
338 // static 345 // static
339 bool SearchViewController::is_ntp_state(State state) { 346 bool SearchViewController::is_ntp_state(State state) {
340 return state == STATE_NTP || state == STATE_NTP_LOADING; 347 return state == STATE_NTP || state == STATE_NTP_LOADING;
341 } 348 }
342 349
343 void SearchViewController::UpdateState() { 350 void SearchViewController::UpdateState() {
344 if (!search_model()) { 351 if (!search_model()) {
345 DestroyViews(); 352 DestroyViews();
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 Profile::FromBrowserContext(browser_context_))); 602 Profile::FromBrowserContext(browser_context_)));
596 } 603 }
597 604
598 chrome::search::SearchModel* SearchViewController::search_model() { 605 chrome::search::SearchModel* SearchViewController::search_model() {
599 return tab_contents_ ? tab_contents_->search_tab_helper()->model() : NULL; 606 return tab_contents_ ? tab_contents_->search_tab_helper()->model() : NULL;
600 } 607 }
601 608
602 content::WebContents* SearchViewController::web_contents() { 609 content::WebContents* SearchViewController::web_contents() {
603 return tab_contents_ ? tab_contents_->web_contents() : NULL; 610 return tab_contents_ ? tab_contents_->web_contents() : NULL;
604 } 611 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/search_view_controller.h ('k') | chrome/browser/ui/views/search_view_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698