| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 show_url_animation_.reset(new gfx::SlideAnimation(this)); | 429 show_url_animation_.reset(new gfx::SlideAnimation(this)); |
| 430 show_url_animation_->SetTweenType(kShowTweenType); | 430 show_url_animation_->SetTweenType(kShowTweenType); |
| 431 show_url_animation_->SetSlideDuration(200); | 431 show_url_animation_->SetSlideDuration(200); |
| 432 | 432 |
| 433 hide_url_animation_.reset(new gfx::SlideAnimation(this)); | 433 hide_url_animation_.reset(new gfx::SlideAnimation(this)); |
| 434 hide_url_animation_->SetTweenType(kHideTweenType); | 434 hide_url_animation_->SetTweenType(kHideTweenType); |
| 435 hide_url_animation_->SetSlideDuration(175); | 435 hide_url_animation_->SetSlideDuration(175); |
| 436 | 436 |
| 437 content::Source<Profile> profile_source = content::Source<Profile>(profile()); | 437 content::Source<Profile> profile_source = content::Source<Profile>(profile()); |
| 438 registrar_.Add(this, | |
| 439 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | |
| 440 profile_source); | |
| 441 registrar_.Add( | 438 registrar_.Add( |
| 442 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); | 439 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); |
| 443 registrar_.Add(this, | 440 registrar_.Add(this, |
| 444 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 441 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 445 profile_source); | 442 profile_source); |
| 446 | 443 |
| 447 // Initialize the location entry. We do this to avoid a black flash which is | 444 // Initialize the location entry. We do this to avoid a black flash which is |
| 448 // visible when the location entry has just been initialized. | 445 // visible when the location entry has just been initialized. |
| 449 Update(NULL); | 446 Update(NULL); |
| 450 } | 447 } |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 ShowFirstRunBubble(); | 1776 ShowFirstRunBubble(); |
| 1780 } | 1777 } |
| 1781 | 1778 |
| 1782 //////////////////////////////////////////////////////////////////////////////// | 1779 //////////////////////////////////////////////////////////////////////////////// |
| 1783 // LocationBarView, private content::NotificationObserver implementation: | 1780 // LocationBarView, private content::NotificationObserver implementation: |
| 1784 | 1781 |
| 1785 void LocationBarView::Observe(int type, | 1782 void LocationBarView::Observe(int type, |
| 1786 const content::NotificationSource& source, | 1783 const content::NotificationSource& source, |
| 1787 const content::NotificationDetails& details) { | 1784 const content::NotificationDetails& details) { |
| 1788 switch (type) { | 1785 switch (type) { |
| 1789 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | |
| 1790 // Only update if the updated action box was for the active tab contents. | |
| 1791 if (content::Details<WebContents>(details).ptr() == GetWebContents()) | |
| 1792 UpdatePageActions(); | |
| 1793 break; | |
| 1794 } | |
| 1795 | |
| 1796 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: | 1786 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 1797 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 1787 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 1798 Update(NULL); | 1788 Update(NULL); |
| 1799 break; | 1789 break; |
| 1800 | 1790 |
| 1801 default: | 1791 default: |
| 1802 NOTREACHED() << "Unexpected notification."; | 1792 NOTREACHED() << "Unexpected notification."; |
| 1803 } | 1793 } |
| 1804 } | 1794 } |
| 1805 | 1795 |
| 1806 //////////////////////////////////////////////////////////////////////////////// | 1796 //////////////////////////////////////////////////////////////////////////////// |
| 1807 // LocationBarView, private SearchModelObserver implementation: | 1797 // LocationBarView, private SearchModelObserver implementation: |
| 1808 | 1798 |
| 1809 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1799 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1810 const SearchModel::State& new_state) { | 1800 const SearchModel::State& new_state) { |
| 1811 const bool visible = !GetToolbarModel()->input_in_progress() && | 1801 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1812 new_state.voice_search_supported; | 1802 new_state.voice_search_supported; |
| 1813 if (mic_search_view_->visible() != visible) { | 1803 if (mic_search_view_->visible() != visible) { |
| 1814 mic_search_view_->SetVisible(visible); | 1804 mic_search_view_->SetVisible(visible); |
| 1815 Layout(); | 1805 Layout(); |
| 1816 } | 1806 } |
| 1817 } | 1807 } |
| 1818 | 1808 |
| OLD | NEW |