OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |