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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months 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/bookmarks/bookmark_bar_instructions_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/defaults.h" 10 #include "chrome/browser/defaults.h"
(...skipping 30 matching lines...) Expand all
41 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)); 41 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK));
42 // We don't want the link to alter tab navigation. 42 // We don't want the link to alter tab navigation.
43 import_link_->SetFocusable(false); 43 import_link_->SetFocusable(false);
44 import_link_->set_listener(this); 44 import_link_->set_listener(this);
45 import_link_->set_context_menu_controller(this); 45 import_link_->set_context_menu_controller(this);
46 import_link_->SetAutoColorReadabilityEnabled(false); 46 import_link_->SetAutoColorReadabilityEnabled(false);
47 AddChildView(import_link_); 47 AddChildView(import_link_);
48 } 48 }
49 } 49 }
50 50
51 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() { 51 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const {
52 int ascent = 0, descent = 0, height = 0, width = 0; 52 int ascent = 0, descent = 0, height = 0, width = 0;
53 for (int i = 0; i < child_count(); ++i) { 53 for (int i = 0; i < child_count(); ++i) {
54 views::View* view = child_at(i); 54 const views::View* view = child_at(i);
55 gfx::Size pref = view->GetPreferredSize(); 55 gfx::Size pref = view->GetPreferredSize();
56 int baseline = view->GetBaseline(); 56 int baseline = view->GetBaseline();
57 if (baseline != -1) { 57 if (baseline != -1) {
58 ascent = std::max(ascent, baseline); 58 ascent = std::max(ascent, baseline);
59 descent = std::max(descent, pref.height() - baseline); 59 descent = std::max(descent, pref.height() - baseline);
60 } else { 60 } else {
61 height = std::max(pref.height(), height); 61 height = std::max(pref.height(), height);
62 } 62 }
63 width += pref.width(); 63 width += pref.width();
64 } 64 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const ui::ThemeProvider* theme_provider = GetThemeProvider(); 120 const ui::ThemeProvider* theme_provider = GetThemeProvider();
121 if (!theme_provider) 121 if (!theme_provider)
122 return; 122 return;
123 updated_colors_ = true; 123 updated_colors_ = true;
124 SkColor text_color = 124 SkColor text_color =
125 theme_provider->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT); 125 theme_provider->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT);
126 instructions_->SetEnabledColor(text_color); 126 instructions_->SetEnabledColor(text_color);
127 if (import_link_) 127 if (import_link_)
128 import_link_->SetEnabledColor(text_color); 128 import_link_->SetEnabledColor(text_color);
129 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698