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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 245993002: Omnibox: Create Field Trial to Always Display Hint Text (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: of->if Created 6 years, 5 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
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/autocomplete/autocomplete_match.h" 15 #include "chrome/browser/autocomplete/autocomplete_match.h"
16 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 16 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
17 #include "chrome/browser/command_updater.h" 17 #include "chrome/browser/command_updater.h"
18 #include "chrome/browser/omnibox/omnibox_field_trial.h"
18 #include "chrome/browser/search/search.h" 19 #include "chrome/browser/search/search.h"
19 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 20 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
20 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 21 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
21 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 22 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
22 #include "chrome/browser/ui/view_ids.h" 23 #include "chrome/browser/ui/view_ids.h"
23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 24 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
24 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" 25 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
25 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" 26 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h"
26 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " 27 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h "
27 #include "components/autocomplete/autocomplete_input.h" 28 #include "components/autocomplete/autocomplete_input.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // and address cases like this, but it seems better to just not muck with 250 // and address cases like this, but it seems better to just not muck with
250 // things when the omnibox isn't focused to begin with. 251 // things when the omnibox isn't focused to begin with.
251 if (was_select_all && model()->has_focus()) 252 if (was_select_all && model()->has_focus())
252 SelectAll(was_reversed); 253 SelectAll(was_reversed);
253 } else if (old_security_level != security_level_) { 254 } else if (old_security_level != security_level_) {
254 EmphasizeURLComponents(); 255 EmphasizeURLComponents();
255 } 256 }
256 } 257 }
257 258
258 void OmniboxViewViews::UpdatePlaceholderText() { 259 void OmniboxViewViews::UpdatePlaceholderText() {
259 if (chrome::ShouldDisplayOriginChip()) 260 if (chrome::ShouldDisplayOriginChip() ||
261 OmniboxFieldTrial::DisplayHintTextWhenPossible())
260 set_placeholder_text(GetHintText()); 262 set_placeholder_text(GetHintText());
261 } 263 }
262 264
263 base::string16 OmniboxViewViews::GetText() const { 265 base::string16 OmniboxViewViews::GetText() const {
264 // TODO(oshima): IME support 266 // TODO(oshima): IME support
265 return text(); 267 return text();
266 } 268 }
267 269
268 void OmniboxViewViews::SetUserText(const base::string16& text, 270 void OmniboxViewViews::SetUserText(const base::string16& text,
269 const base::string16& display_text, 271 const base::string16& display_text,
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 menu_contents->InsertItemWithStringIdAt( 1019 menu_contents->InsertItemWithStringIdAt(
1018 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); 1020 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL);
1019 } 1021 }
1020 1022
1021 // Minor note: We use IDC_ for command id here while the underlying textfield 1023 // Minor note: We use IDC_ for command id here while the underlying textfield
1022 // is using IDS_ for all its command ids. This is because views cannot depend 1024 // is using IDS_ for all its command ids. This is because views cannot depend
1023 // on IDC_ for now. 1025 // on IDC_ for now.
1024 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1026 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1025 IDS_EDIT_SEARCH_ENGINES); 1027 IDS_EDIT_SEARCH_ENGINES);
1026 } 1028 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698