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 // 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 "ui/base/clipboard/clipboard.h" | 14 #include "ui/base/clipboard/clipboard.h" |
15 | 15 |
16 // static | 16 // static |
17 string16 OmniboxView::StripJavascriptSchemas(const string16& text) { | 17 string16 OmniboxView::StripJavascriptSchemas(const string16& text) { |
18 const string16 kJsPrefix(ASCIIToUTF16(chrome::kJavaScriptScheme) + | 18 const string16 kJsPrefix(ASCIIToUTF16(content::kJavaScriptScheme) + |
19 ASCIIToUTF16(":")); | 19 ASCIIToUTF16(":")); |
20 string16 out(text); | 20 string16 out(text); |
21 while (StartsWith(out, kJsPrefix, false)) | 21 while (StartsWith(out, kJsPrefix, false)) |
22 TrimWhitespace(out.substr(kJsPrefix.length()), TRIM_LEADING, &out); | 22 TrimWhitespace(out.substr(kJsPrefix.length()), TRIM_LEADING, &out); |
23 return out; | 23 return out; |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 string16 OmniboxView::SanitizeTextForPaste(const string16& text) { | 27 string16 OmniboxView::SanitizeTextForPaste(const string16& text) { |
28 // Check for non-newline whitespace; if found, collapse whitespace runs down | 28 // Check for non-newline whitespace; if found, collapse whitespace runs down |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // |profile| can be NULL in tests. | 151 // |profile| can be NULL in tests. |
152 if (profile) | 152 if (profile) |
153 model_.reset(new OmniboxEditModel(this, controller, profile)); | 153 model_.reset(new OmniboxEditModel(this, controller, profile)); |
154 } | 154 } |
155 | 155 |
156 void OmniboxView::TextChanged() { | 156 void OmniboxView::TextChanged() { |
157 EmphasizeURLComponents(); | 157 EmphasizeURLComponents(); |
158 if (model_.get()) | 158 if (model_.get()) |
159 model_->OnChanged(); | 159 model_->OnChanged(); |
160 } | 160 } |
OLD | NEW |