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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. Created 8 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/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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 // If the browser is no longer active, let's not show the info bubble, as this 1578 // If the browser is no longer active, let's not show the info bubble, as this
1579 // would make the browser the active window again. 1579 // would make the browser the active window again.
1580 if (location_entry_view_ && location_entry_view_->GetWidget()->IsActive()) 1580 if (location_entry_view_ && location_entry_view_->GetWidget()->IsActive())
1581 ShowFirstRunBubble(); 1581 ShowFirstRunBubble();
1582 } 1582 }
1583 1583
1584 void LocationBarView::Observe(int type, 1584 void LocationBarView::Observe(int type,
1585 const content::NotificationSource& source, 1585 const content::NotificationSource& source,
1586 const content::NotificationDetails& details) { 1586 const content::NotificationDetails& details) {
1587 switch (type) { 1587 switch (type) {
1588 case chrome::NOTIFICATION_PREF_CHANGED: {
1589 std::string* name = content::Details<std::string>(details).ptr();
1590 if (*name == prefs::kEditBookmarksEnabled)
1591 Update(NULL);
1592 break;
1593 }
1594
1595 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { 1588 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: {
1596 // Only update if the updated action box was for the active tab contents. 1589 // Only update if the updated action box was for the active tab contents.
1597 WebContents* target_tab = content::Details<WebContents>(details).ptr(); 1590 WebContents* target_tab = content::Details<WebContents>(details).ptr();
1598 if (target_tab == GetTabContents()->web_contents()) 1591 if (target_tab == GetTabContents()->web_contents())
1599 UpdatePageActions(); 1592 UpdatePageActions();
1600 break; 1593 break;
1601 } 1594 }
1602 1595
1603 default: 1596 default:
1604 NOTREACHED() << "Unexpected notification."; 1597 NOTREACHED() << "Unexpected notification.";
1605 } 1598 }
1606 } 1599 }
1607 1600
1601 void LocationBarView::OnPreferenceChanged(PrefServiceBase* service,
1602 const std::string& pref_name) {
1603 if (pref_name == prefs::kEditBookmarksEnabled)
1604 Update(NULL);
1605 }
1606
1608 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1607 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1609 int total_height = 1608 int total_height =
1610 use_preferred_size ? GetPreferredSize().height() : height(); 1609 use_preferred_size ? GetPreferredSize().height() : height();
1611 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1610 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1612 } 1611 }
1613 1612
1614 bool LocationBarView::HasValidSuggestText() const { 1613 bool LocationBarView::HasValidSuggestText() const {
1615 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1614 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1616 !suggested_text_view_->text().empty(); 1615 !suggested_text_view_->text().empty();
1617 } 1616 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 } 1683 }
1685 1684
1686 void LocationBarView::CleanupFadeAnimation() { 1685 void LocationBarView::CleanupFadeAnimation() {
1687 // Since we're no longer animating we don't need our layer. 1686 // Since we're no longer animating we don't need our layer.
1688 SetPaintToLayer(false); 1687 SetPaintToLayer(false);
1689 // Bubble labels don't need a transparent background anymore. 1688 // Bubble labels don't need a transparent background anymore.
1690 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1689 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1691 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1690 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1692 } 1691 }
1693 #endif // USE_AURA 1692 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698