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

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 to head for commit 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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 // If the browser is no longer active, let's not show the info bubble, as this 1567 // If the browser is no longer active, let's not show the info bubble, as this
1568 // would make the browser the active window again. 1568 // would make the browser the active window again.
1569 if (location_entry_view_ && location_entry_view_->GetWidget()->IsActive()) 1569 if (location_entry_view_ && location_entry_view_->GetWidget()->IsActive())
1570 ShowFirstRunBubble(); 1570 ShowFirstRunBubble();
1571 } 1571 }
1572 1572
1573 void LocationBarView::Observe(int type, 1573 void LocationBarView::Observe(int type,
1574 const content::NotificationSource& source, 1574 const content::NotificationSource& source,
1575 const content::NotificationDetails& details) { 1575 const content::NotificationDetails& details) {
1576 switch (type) { 1576 switch (type) {
1577 case chrome::NOTIFICATION_PREF_CHANGED: {
1578 std::string* name = content::Details<std::string>(details).ptr();
1579 if (*name == prefs::kEditBookmarksEnabled)
1580 Update(NULL);
1581 break;
1582 }
1583
1584 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { 1577 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: {
1585 // Only update if the updated action box was for the active tab contents. 1578 // Only update if the updated action box was for the active tab contents.
1586 WebContents* target_tab = content::Details<WebContents>(details).ptr(); 1579 WebContents* target_tab = content::Details<WebContents>(details).ptr();
1587 if (target_tab == GetTabContents()->web_contents()) 1580 if (target_tab == GetTabContents()->web_contents())
1588 UpdatePageActions(); 1581 UpdatePageActions();
1589 break; 1582 break;
1590 } 1583 }
1591 1584
1592 default: 1585 default:
1593 NOTREACHED() << "Unexpected notification."; 1586 NOTREACHED() << "Unexpected notification.";
1594 } 1587 }
1595 } 1588 }
1596 1589
1590 void LocationBarView::OnPreferenceChanged(PrefServiceBase* service,
1591 const std::string& pref_name) {
1592 if (pref_name == prefs::kEditBookmarksEnabled)
1593 Update(NULL);
1594 }
1595
1597 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1596 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1598 int total_height = 1597 int total_height =
1599 use_preferred_size ? GetPreferredSize().height() : height(); 1598 use_preferred_size ? GetPreferredSize().height() : height();
1600 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1599 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1601 } 1600 }
1602 1601
1603 bool LocationBarView::HasValidSuggestText() const { 1602 bool LocationBarView::HasValidSuggestText() const {
1604 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1603 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1605 !suggested_text_view_->text().empty(); 1604 !suggested_text_view_->text().empty();
1606 } 1605 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } 1671 }
1673 1672
1674 void LocationBarView::CleanupFadeAnimation() { 1673 void LocationBarView::CleanupFadeAnimation() {
1675 // Since we're no longer animating we don't need our layer. 1674 // Since we're no longer animating we don't need our layer.
1676 SetPaintToLayer(false); 1675 SetPaintToLayer(false);
1677 // Bubble labels don't need a transparent background anymore. 1676 // Bubble labels don't need a transparent background anymore.
1678 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1677 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1679 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1678 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1680 } 1679 }
1681 #endif // USE_AURA 1680 #endif // USE_AURA
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698