OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/searchbox/searchbox_extension.h" | 5 #include "chrome/renderer/searchbox/searchbox_extension.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/common/instant_types.h" | 13 #include "chrome/common/instant_types.h" |
14 #include "chrome/common/ntp_logging_events.h" | 14 #include "chrome/common/ntp_logging_events.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "chrome/grit/renderer_resources.h" | 16 #include "chrome/grit/renderer_resources.h" |
17 #include "chrome/renderer/searchbox/searchbox.h" | 17 #include "chrome/renderer/searchbox/searchbox.h" |
| 18 #include "components/crx_file/id_util.h" |
18 #include "content/public/renderer/render_view.h" | 19 #include "content/public/renderer/render_view.h" |
19 #include "extensions/common/extension.h" | |
20 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 20 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
21 #include "third_party/WebKit/public/web/WebDocument.h" | 21 #include "third_party/WebKit/public/web/WebDocument.h" |
22 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
23 #include "third_party/WebKit/public/web/WebScriptSource.h" | 23 #include "third_party/WebKit/public/web/WebScriptSource.h" |
24 #include "third_party/WebKit/public/web/WebView.h" | 24 #include "third_party/WebKit/public/web/WebView.h" |
25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
26 #include "ui/base/window_open_disposition.h" | 26 #include "ui/base/window_open_disposition.h" |
27 #include "ui/events/keycodes/keyboard_codes.h" | 27 #include "ui/events/keycodes/keyboard_codes.h" |
28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
29 #include "url/url_constants.h" | 29 #include "url/url_constants.h" |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 // The theme alternate logo value indicates a white logo when TRUE and a | 842 // The theme alternate logo value indicates a white logo when TRUE and a |
843 // colorful one when FALSE. | 843 // colorful one when FALSE. |
844 info->Set(v8::String::NewFromUtf8(isolate, "alternateLogo"), | 844 info->Set(v8::String::NewFromUtf8(isolate, "alternateLogo"), |
845 v8::Boolean::New(isolate, theme_info.logo_alternate)); | 845 v8::Boolean::New(isolate, theme_info.logo_alternate)); |
846 | 846 |
847 // The theme background image url is of format kCSSBackgroundImageFormat | 847 // The theme background image url is of format kCSSBackgroundImageFormat |
848 // where both instances of "%s" are replaced with the id that identifies the | 848 // where both instances of "%s" are replaced with the id that identifies the |
849 // theme. | 849 // theme. |
850 // This is the CSS "background-image" format. | 850 // This is the CSS "background-image" format. |
851 // Value is only valid if there's a custom theme background image. | 851 // Value is only valid if there's a custom theme background image. |
852 if (extensions::Extension::IdIsValid(theme_info.theme_id)) { | 852 if (crx_file::id_util::IdIsValid(theme_info.theme_id)) { |
853 info->Set(v8::String::NewFromUtf8(isolate, "imageUrl"), | 853 info->Set(v8::String::NewFromUtf8(isolate, "imageUrl"), |
854 UTF8ToV8String(isolate, | 854 UTF8ToV8String(isolate, |
855 base::StringPrintf(kCSSBackgroundImageFormat, | 855 base::StringPrintf(kCSSBackgroundImageFormat, |
856 theme_info.theme_id.c_str(), | 856 theme_info.theme_id.c_str(), |
857 theme_info.theme_id.c_str()))); | 857 theme_info.theme_id.c_str()))); |
858 | 858 |
859 // The theme background image horizontal alignment is one of "left", | 859 // The theme background image horizontal alignment is one of "left", |
860 // "right", "center". | 860 // "right", "center". |
861 // This is the horizontal component of the CSS "background-position" format. | 861 // This is the horizontal component of the CSS "background-position" format. |
862 // Value is only valid if |imageUrl| is not empty. | 862 // Value is only valid if |imageUrl| is not empty. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 if (!render_view) return; | 1118 if (!render_view) return; |
1119 | 1119 |
1120 bool display_instant_results = | 1120 bool display_instant_results = |
1121 SearchBox::Get(render_view)->display_instant_results(); | 1121 SearchBox::Get(render_view)->display_instant_results(); |
1122 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1122 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
1123 display_instant_results; | 1123 display_instant_results; |
1124 args.GetReturnValue().Set(display_instant_results); | 1124 args.GetReturnValue().Set(display_instant_results); |
1125 } | 1125 } |
1126 | 1126 |
1127 } // namespace extensions_v8 | 1127 } // namespace extensions_v8 |
OLD | NEW |