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

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

Powered by Google App Engine
This is Rietveld 408576698