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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view.cc

Issue 183853011: Move TrimWhitespace to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 // This file defines helper functions shared by the various implementations 5 // This file defines helper functions shared by the various implementations
6 // of OmniboxView. 6 // of OmniboxView.
7 7
8 #include "chrome/browser/ui/omnibox/omnibox_view.h" 8 #include "chrome/browser/ui/omnibox/omnibox_view.h"
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 13 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "chrome/browser/search_engines/template_url.h" 14 #include "chrome/browser/search_engines/template_url.h"
15 #include "chrome/browser/search_engines/template_url_service.h" 15 #include "chrome/browser/search_engines/template_url_service.h"
16 #include "chrome/browser/search_engines/template_url_service_factory.h" 16 #include "chrome/browser/search_engines/template_url_service_factory.h"
17 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 17 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
18 #include "chrome/browser/ui/toolbar/toolbar_model.h" 18 #include "chrome/browser/ui/toolbar/toolbar_model.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "ui/base/clipboard/clipboard.h" 20 #include "ui/base/clipboard/clipboard.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 22
23 // static 23 // static
24 base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) { 24 base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) {
25 const base::string16 kJsPrefix( 25 const base::string16 kJsPrefix(
26 base::ASCIIToUTF16(content::kJavaScriptScheme) + base::ASCIIToUTF16(":")); 26 base::ASCIIToUTF16(content::kJavaScriptScheme) + base::ASCIIToUTF16(":"));
27 base::string16 out(text); 27 base::string16 out(text);
28 while (StartsWith(out, kJsPrefix, false)) 28 while (StartsWith(out, kJsPrefix, false)) {
29 TrimWhitespace(out.substr(kJsPrefix.length()), TRIM_LEADING, &out); 29 base::TrimWhitespace(out.substr(kJsPrefix.length()), base::TRIM_LEADING,
30 &out);
31 }
30 return out; 32 return out;
31 } 33 }
32 34
33 // static 35 // static
34 base::string16 OmniboxView::SanitizeTextForPaste(const base::string16& text) { 36 base::string16 OmniboxView::SanitizeTextForPaste(const base::string16& text) {
35 // Check for non-newline whitespace; if found, collapse whitespace runs down 37 // Check for non-newline whitespace; if found, collapse whitespace runs down
36 // to single spaces. 38 // to single spaces.
37 // TODO(shess): It may also make sense to ignore leading or 39 // TODO(shess): It may also make sense to ignore leading or
38 // trailing whitespace when making this determination. 40 // trailing whitespace when making this determination.
39 for (size_t i = 0; i < text.size(); ++i) { 41 for (size_t i = 0; i < text.size(); ++i) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // |profile| can be NULL in tests. 192 // |profile| can be NULL in tests.
191 if (profile) 193 if (profile)
192 model_.reset(new OmniboxEditModel(this, controller, profile)); 194 model_.reset(new OmniboxEditModel(this, controller, profile));
193 } 195 }
194 196
195 void OmniboxView::TextChanged() { 197 void OmniboxView::TextChanged() {
196 EmphasizeURLComponents(); 198 EmphasizeURLComponents();
197 if (model_.get()) 199 if (model_.get())
198 model_->OnChanged(); 200 model_->OnChanged();
199 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/browser/ui/search_engines/edit_search_engine_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698