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/search/search.h" | 13 #include "chrome/browser/search/search.h" |
14 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
15 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 15 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
16 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 16 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 17 #include "chrome/grit/generated_resources.h" |
17 #include "components/omnibox/autocomplete_match.h" | 18 #include "components/omnibox/autocomplete_match.h" |
18 #include "components/search_engines/template_url.h" | 19 #include "components/search_engines/template_url.h" |
19 #include "components/search_engines/template_url_service.h" | 20 #include "components/search_engines/template_url_service.h" |
20 #include "grit/component_scaled_resources.h" | 21 #include "grit/component_scaled_resources.h" |
21 #include "grit/generated_resources.h" | |
22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
23 #include "ui/base/clipboard/clipboard.h" | 23 #include "ui/base/clipboard/clipboard.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 | 25 |
26 // static | 26 // static |
27 base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) { | 27 base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) { |
28 const base::string16 kJsPrefix( | 28 const base::string16 kJsPrefix( |
29 base::ASCIIToUTF16(url::kJavaScriptScheme) + base::ASCIIToUTF16(":")); | 29 base::ASCIIToUTF16(url::kJavaScriptScheme) + base::ASCIIToUTF16(":")); |
30 base::string16 out(text); | 30 base::string16 out(text); |
31 while (StartsWith(out, kJsPrefix, false)) { | 31 while (StartsWith(out, kJsPrefix, false)) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // |profile| can be NULL in tests. | 227 // |profile| can be NULL in tests. |
228 if (profile) | 228 if (profile) |
229 model_.reset(new OmniboxEditModel(this, controller, profile)); | 229 model_.reset(new OmniboxEditModel(this, controller, profile)); |
230 } | 230 } |
231 | 231 |
232 void OmniboxView::TextChanged() { | 232 void OmniboxView::TextChanged() { |
233 EmphasizeURLComponents(); | 233 EmphasizeURLComponents(); |
234 if (model_.get()) | 234 if (model_.get()) |
235 model_->OnChanged(); | 235 model_->OnChanged(); |
236 } | 236 } |
OLD | NEW |