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

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

Issue 11421029: Remove PrefObserver usages, batch 13. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix - rebase Created 8 years 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (mode_ == NORMAL) { 195 if (mode_ == NORMAL) {
196 background_painter_.reset( 196 background_painter_.reset(
197 views::Painter::CreateImagePainter( 197 views::Painter::CreateImagePainter(
198 *ui::ResourceBundle::GetSharedInstance().GetImageNamed( 198 *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
199 IDR_LOCATION_BAR_BORDER).ToImageSkia(), 199 IDR_LOCATION_BAR_BORDER).ToImageSkia(),
200 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, 200 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth,
201 kBorderRoundCornerHeight, kBorderRoundCornerWidth), 201 kBorderRoundCornerHeight, kBorderRoundCornerWidth),
202 true)); 202 true));
203 } 203 }
204 204
205 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, 205 edit_bookmarks_enabled_.Init(
206 profile_->GetPrefs(), this); 206 prefs::kEditBookmarksEnabled,
207 profile_->GetPrefs(),
208 base::Bind(&LocationBarView::Update,
209 base::Unretained(this),
210 static_cast<content::WebContents*>(NULL)));
207 } 211 }
208 212
209 LocationBarView::~LocationBarView() { 213 LocationBarView::~LocationBarView() {
210 if (template_url_service_) 214 if (template_url_service_)
211 template_url_service_->RemoveObserver(this); 215 template_url_service_->RemoveObserver(this);
212 } 216 }
213 217
214 void LocationBarView::Init() { 218 void LocationBarView::Init() {
215 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're 219 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're
216 // not prepared for that. 220 // not prepared for that.
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 if (target_tab == GetWebContents()) 1508 if (target_tab == GetWebContents())
1505 UpdatePageActions(); 1509 UpdatePageActions();
1506 break; 1510 break;
1507 } 1511 }
1508 1512
1509 default: 1513 default:
1510 NOTREACHED() << "Unexpected notification."; 1514 NOTREACHED() << "Unexpected notification.";
1511 } 1515 }
1512 } 1516 }
1513 1517
1514 void LocationBarView::OnPreferenceChanged(PrefServiceBase* service,
1515 const std::string& pref_name) {
1516 if (pref_name == prefs::kEditBookmarksEnabled)
1517 Update(NULL);
1518 }
1519
1520 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1518 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1521 int total_height = 1519 int total_height =
1522 use_preferred_size ? GetPreferredSize().height() : height(); 1520 use_preferred_size ? GetPreferredSize().height() : height();
1523 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1521 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1524 } 1522 }
1525 1523
1526 bool LocationBarView::HasValidSuggestText() const { 1524 bool LocationBarView::HasValidSuggestText() const {
1527 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1525 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1528 !suggested_text_view_->text().empty(); 1526 !suggested_text_view_->text().empty();
1529 } 1527 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/webui/options/content_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698