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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 } | 1157 } |
1158 } else { | 1158 } else { |
1159 // Resolve the URL | 1159 // Resolve the URL |
1160 const base::string16& possibly_relative_url = V8ValueToUTF16(args[0]); | 1160 const base::string16& possibly_relative_url = V8ValueToUTF16(args[0]); |
1161 GURL current_url = GetCurrentURL(render_view); | 1161 GURL current_url = GetCurrentURL(render_view); |
1162 destination_url = internal::ResolveURL(current_url, possibly_relative_url); | 1162 destination_url = internal::ResolveURL(current_url, possibly_relative_url); |
1163 } | 1163 } |
1164 | 1164 |
1165 DVLOG(1) << render_view << " NavigateContentWindow: " << destination_url; | 1165 DVLOG(1) << render_view << " NavigateContentWindow: " << destination_url; |
1166 | 1166 |
1167 // Navigate the main frame. | 1167 // Navigate the main frame. Note that the security checks are enforced by the |
| 1168 // browser process in InstantService::IsValidURLForNavigation(), but some |
| 1169 // simple checks here are useful for avoiding unnecessary IPCs. |
1168 if (destination_url.is_valid() && | 1170 if (destination_url.is_valid() && |
1169 !destination_url.SchemeIs(url::kJavaScriptScheme)) { | 1171 !destination_url.SchemeIs(url::kJavaScriptScheme)) { |
1170 WindowOpenDisposition disposition = CURRENT_TAB; | 1172 WindowOpenDisposition disposition = CURRENT_TAB; |
1171 if (args[1]->IsNumber()) { | 1173 if (args[1]->IsNumber()) { |
1172 disposition = (WindowOpenDisposition) args[1]->Uint32Value(); | 1174 disposition = (WindowOpenDisposition) args[1]->Uint32Value(); |
1173 } | 1175 } |
1174 SearchBox::Get(render_view)->NavigateToURL(destination_url, disposition, | 1176 SearchBox::Get(render_view)->NavigateToURL(destination_url, disposition, |
1175 is_most_visited_item_url); | 1177 is_most_visited_item_url); |
1176 } | 1178 } |
1177 } | 1179 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 if (!render_view) return; | 1246 if (!render_view) return; |
1245 | 1247 |
1246 bool display_instant_results = | 1248 bool display_instant_results = |
1247 SearchBox::Get(render_view)->display_instant_results(); | 1249 SearchBox::Get(render_view)->display_instant_results(); |
1248 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1250 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
1249 display_instant_results; | 1251 display_instant_results; |
1250 args.GetReturnValue().Set(display_instant_results); | 1252 args.GetReturnValue().Set(display_instant_results); |
1251 } | 1253 } |
1252 | 1254 |
1253 } // namespace extensions_v8 | 1255 } // namespace extensions_v8 |
OLD | NEW |