| 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 show_url_animation_->SetSlideDuration(200); | 438 show_url_animation_->SetSlideDuration(200); |
| 439 | 439 |
| 440 hide_url_animation_.reset(new gfx::SlideAnimation(this)); | 440 hide_url_animation_.reset(new gfx::SlideAnimation(this)); |
| 441 hide_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | 441 hide_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); |
| 442 hide_url_animation_->SetSlideDuration(200); | 442 hide_url_animation_->SetSlideDuration(200); |
| 443 | 443 |
| 444 content::Source<Profile> profile_source = content::Source<Profile>(profile()); | 444 content::Source<Profile> profile_source = content::Source<Profile>(profile()); |
| 445 registrar_.Add(this, | 445 registrar_.Add(this, |
| 446 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 446 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 447 profile_source); | 447 profile_source); |
| 448 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 448 registrar_.Add( |
| 449 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); |
| 449 registrar_.Add(this, | 450 registrar_.Add(this, |
| 450 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 451 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 451 profile_source); | 452 profile_source); |
| 452 | 453 |
| 453 // Initialize the location entry. We do this to avoid a black flash which is | 454 // Initialize the location entry. We do this to avoid a black flash which is |
| 454 // visible when the location entry has just been initialized. | 455 // visible when the location entry has just been initialized. |
| 455 Update(NULL); | 456 Update(NULL); |
| 456 } | 457 } |
| 457 | 458 |
| 458 bool LocationBarView::IsInitialized() const { | 459 bool LocationBarView::IsInitialized() const { |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 const content::NotificationDetails& details) { | 1679 const content::NotificationDetails& details) { |
| 1679 switch (type) { | 1680 switch (type) { |
| 1680 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | 1681 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
| 1681 // Only update if the updated action box was for the active tab contents. | 1682 // Only update if the updated action box was for the active tab contents. |
| 1682 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | 1683 WebContents* target_tab = content::Details<WebContents>(details).ptr(); |
| 1683 if (target_tab == GetWebContents()) | 1684 if (target_tab == GetWebContents()) |
| 1684 UpdatePageActions(); | 1685 UpdatePageActions(); |
| 1685 break; | 1686 break; |
| 1686 } | 1687 } |
| 1687 | 1688 |
| 1688 case chrome::NOTIFICATION_EXTENSION_LOADED: | 1689 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 1689 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 1690 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 1690 Update(NULL); | 1691 Update(NULL); |
| 1691 break; | 1692 break; |
| 1692 | 1693 |
| 1693 default: | 1694 default: |
| 1694 NOTREACHED() << "Unexpected notification."; | 1695 NOTREACHED() << "Unexpected notification."; |
| 1695 } | 1696 } |
| 1696 } | 1697 } |
| 1697 | 1698 |
| 1698 //////////////////////////////////////////////////////////////////////////////// | 1699 //////////////////////////////////////////////////////////////////////////////// |
| 1699 // LocationBarView, private SearchModelObserver implementation: | 1700 // LocationBarView, private SearchModelObserver implementation: |
| 1700 | 1701 |
| 1701 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1702 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1702 const SearchModel::State& new_state) { | 1703 const SearchModel::State& new_state) { |
| 1703 const bool visible = !GetToolbarModel()->input_in_progress() && | 1704 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1704 new_state.voice_search_supported; | 1705 new_state.voice_search_supported; |
| 1705 if (mic_search_view_->visible() != visible) { | 1706 if (mic_search_view_->visible() != visible) { |
| 1706 mic_search_view_->SetVisible(visible); | 1707 mic_search_view_->SetVisible(visible); |
| 1707 Layout(); | 1708 Layout(); |
| 1708 } | 1709 } |
| 1709 } | 1710 } |
| 1710 | 1711 |
| OLD | NEW |