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

Side by Side Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 years, 6 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
OLDNEW
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/autocomplete_match_type.h" 13 #include "chrome/common/autocomplete_match_type.h"
14 #include "chrome/common/instant_types.h" 14 #include "chrome/common/instant_types.h"
15 #include "chrome/common/ntp_logging_events.h" 15 #include "chrome/common/ntp_logging_events.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/renderer/searchbox/searchbox.h" 17 #include "chrome/renderer/searchbox/searchbox.h"
18 #include "content/public/common/url_constants.h"
19 #include "content/public/renderer/render_view.h" 18 #include "content/public/renderer/render_view.h"
20 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
21 #include "grit/renderer_resources.h" 20 #include "grit/renderer_resources.h"
22 #include "third_party/WebKit/public/platform/WebURLRequest.h" 21 #include "third_party/WebKit/public/platform/WebURLRequest.h"
23 #include "third_party/WebKit/public/web/WebDocument.h" 22 #include "third_party/WebKit/public/web/WebDocument.h"
24 #include "third_party/WebKit/public/web/WebLocalFrame.h" 23 #include "third_party/WebKit/public/web/WebLocalFrame.h"
25 #include "third_party/WebKit/public/web/WebScriptSource.h" 24 #include "third_party/WebKit/public/web/WebScriptSource.h"
26 #include "third_party/WebKit/public/web/WebView.h" 25 #include "third_party/WebKit/public/web/WebView.h"
27 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
28 #include "ui/base/window_open_disposition.h" 27 #include "ui/base/window_open_disposition.h"
29 #include "ui/events/keycodes/keyboard_codes.h" 28 #include "ui/events/keycodes/keyboard_codes.h"
30 #include "url/gurl.h" 29 #include "url/gurl.h"
30 #include "url/url_constants.h"
31 #include "v8/include/v8.h" 31 #include "v8/include/v8.h"
32 32
33 namespace { 33 namespace {
34 34
35 const char kCSSBackgroundImageFormat[] = "-webkit-image-set(" 35 const char kCSSBackgroundImageFormat[] = "-webkit-image-set("
36 "url(chrome-search://theme/IDR_THEME_NTP_BACKGROUND?%s) 1x, " 36 "url(chrome-search://theme/IDR_THEME_NTP_BACKGROUND?%s) 1x, "
37 "url(chrome-search://theme/IDR_THEME_NTP_BACKGROUND@2x?%s) 2x)"; 37 "url(chrome-search://theme/IDR_THEME_NTP_BACKGROUND@2x?%s) 2x)";
38 38
39 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)"; 39 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)";
40 40
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 // Resolve the URL 1031 // Resolve the URL
1032 const base::string16& possibly_relative_url = V8ValueToUTF16(args[0]); 1032 const base::string16& possibly_relative_url = V8ValueToUTF16(args[0]);
1033 GURL current_url = GetCurrentURL(render_view); 1033 GURL current_url = GetCurrentURL(render_view);
1034 destination_url = internal::ResolveURL(current_url, possibly_relative_url); 1034 destination_url = internal::ResolveURL(current_url, possibly_relative_url);
1035 } 1035 }
1036 1036
1037 DVLOG(1) << render_view << " NavigateContentWindow: " << destination_url; 1037 DVLOG(1) << render_view << " NavigateContentWindow: " << destination_url;
1038 1038
1039 // Navigate the main frame. 1039 // Navigate the main frame.
1040 if (destination_url.is_valid() && 1040 if (destination_url.is_valid() &&
1041 !destination_url.SchemeIs(content::kJavaScriptScheme)) { 1041 !destination_url.SchemeIs(url::kJavaScriptScheme)) {
1042 WindowOpenDisposition disposition = CURRENT_TAB; 1042 WindowOpenDisposition disposition = CURRENT_TAB;
1043 if (args[1]->IsNumber()) { 1043 if (args[1]->IsNumber()) {
1044 disposition = (WindowOpenDisposition) args[1]->Uint32Value(); 1044 disposition = (WindowOpenDisposition) args[1]->Uint32Value();
1045 } 1045 }
1046 SearchBox::Get(render_view)->NavigateToURL(destination_url, disposition, 1046 SearchBox::Get(render_view)->NavigateToURL(destination_url, disposition,
1047 is_most_visited_item_url); 1047 is_most_visited_item_url);
1048 } 1048 }
1049 } 1049 }
1050 1050
1051 // static 1051 // static
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 if (!render_view) return; 1119 if (!render_view) return;
1120 1120
1121 bool display_instant_results = 1121 bool display_instant_results =
1122 SearchBox::Get(render_view)->display_instant_results(); 1122 SearchBox::Get(render_view)->display_instant_results();
1123 DVLOG(1) << render_view << " GetDisplayInstantResults" << 1123 DVLOG(1) << render_view << " GetDisplayInstantResults" <<
1124 display_instant_results; 1124 display_instant_results;
1125 args.GetReturnValue().Set(display_instant_results); 1125 args.GetReturnValue().Set(display_instant_results);
1126 } 1126 }
1127 1127
1128 } // namespace extensions_v8 1128 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_extension_helper.cc ('k') | chrome/renderer/translate/translate_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698