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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.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/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 int OmniboxViewViews::GetTextWidth() const { 313 int OmniboxViewViews::GetTextWidth() const {
314 // Returns the width necessary to display the current text, including any 314 // Returns the width necessary to display the current text, including any
315 // necessary space for the cursor or border/margin. 315 // necessary space for the cursor or border/margin.
316 return GetRenderText()->GetContentWidth() + GetInsets().width(); 316 return GetRenderText()->GetContentWidth() + GetInsets().width();
317 } 317 }
318 318
319 bool OmniboxViewViews::IsImeComposing() const { 319 bool OmniboxViewViews::IsImeComposing() const {
320 return IsIMEComposing(); 320 return IsIMEComposing();
321 } 321 }
322 322
323 gfx::Size OmniboxViewViews::GetMinimumSize() { 323 gfx::Size OmniboxViewViews::GetMinimumSize() const {
324 const int kMinCharacters = 10; 324 const int kMinCharacters = 10;
325 return gfx::Size( 325 return gfx::Size(
326 GetFontList().GetExpectedTextWidth(kMinCharacters) + GetInsets().width(), 326 GetFontList().GetExpectedTextWidth(kMinCharacters) + GetInsets().width(),
327 GetPreferredSize().height()); 327 GetPreferredSize().height());
328 } 328 }
329 329
330 void OmniboxViewViews::OnNativeThemeChanged(const ui::NativeTheme* theme) { 330 void OmniboxViewViews::OnNativeThemeChanged(const ui::NativeTheme* theme) {
331 views::Textfield::OnNativeThemeChanged(theme); 331 views::Textfield::OnNativeThemeChanged(theme);
332 SetBackgroundColor(location_bar_view_->GetColor( 332 SetBackgroundColor(location_bar_view_->GetColor(
333 ToolbarModel::NONE, LocationBarView::BACKGROUND)); 333 ToolbarModel::NONE, LocationBarView::BACKGROUND));
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 menu_contents->InsertItemWithStringIdAt( 1034 menu_contents->InsertItemWithStringIdAt(
1035 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); 1035 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL);
1036 } 1036 }
1037 1037
1038 // Minor note: We use IDC_ for command id here while the underlying textfield 1038 // Minor note: We use IDC_ for command id here while the underlying textfield
1039 // is using IDS_ for all its command ids. This is because views cannot depend 1039 // is using IDS_ for all its command ids. This is because views cannot depend
1040 // on IDC_ for now. 1040 // on IDC_ for now.
1041 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1041 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1042 IDS_EDIT_SEARCH_ENGINES); 1042 IDS_EDIT_SEARCH_ENGINES);
1043 } 1043 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | chrome/browser/ui/views/panels/panel_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698