OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" | 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1180 const std::string& virtual_url, | 1180 const std::string& virtual_url, |
1181 std::string* error) { | 1181 std::string* error) { |
1182 // Make GURLs from URLs. | 1182 // Make GURLs from URLs. |
1183 const GURL data_gurl = GURL(data_url); | 1183 const GURL data_gurl = GURL(data_url); |
1184 const GURL base_gurl = GURL(base_url); | 1184 const GURL base_gurl = GURL(base_url); |
1185 const GURL virtual_gurl = GURL(virtual_url); | 1185 const GURL virtual_gurl = GURL(virtual_url); |
1186 | 1186 |
1187 // Check that the provided URLs are valid. | 1187 // Check that the provided URLs are valid. |
1188 // |data_url| must be a valid data URL. | 1188 // |data_url| must be a valid data URL. |
1189 if (!data_gurl.is_valid() || !data_gurl.SchemeIs(url::kDataScheme)) { | 1189 if (!data_gurl.is_valid() || !data_gurl.SchemeIs(url::kDataScheme)) { |
1190 base::SStringPrintf( | 1190 /*base::SStringPrintf( |
1191 error, webview::kAPILoadDataInvalidDataURL, data_url.c_str()); | 1191 error, webview::kAPILoadDataInvalidDataURL, data_url.c_str());*/ |
brucedawson
2015/10/20 21:43:00
String printing of GURLs (three very similar insta
| |
1192 return false; | 1192 return false; |
1193 } | 1193 } |
1194 // |base_url| must be a valid URL. | 1194 // |base_url| must be a valid URL. |
1195 if (!base_gurl.is_valid()) { | 1195 if (!base_gurl.is_valid()) { |
1196 base::SStringPrintf( | 1196 /*base::SStringPrintf( |
1197 error, webview::kAPILoadDataInvalidBaseURL, base_url.c_str()); | 1197 error, webview::kAPILoadDataInvalidBaseURL, base_url.c_str());*/ |
1198 return false; | 1198 return false; |
1199 } | 1199 } |
1200 // |virtual_url| must be a valid URL. | 1200 // |virtual_url| must be a valid URL. |
1201 if (!virtual_gurl.is_valid()) { | 1201 if (!virtual_gurl.is_valid()) { |
1202 base::SStringPrintf( | 1202 /*base::SStringPrintf( |
1203 error, webview::kAPILoadDataInvalidVirtualURL, virtual_url.c_str()); | 1203 error, webview::kAPILoadDataInvalidVirtualURL, virtual_url.c_str());*/ |
1204 return false; | 1204 return false; |
1205 } | 1205 } |
1206 | 1206 |
1207 // Set up the parameters to load |data_url| with the specified |base_url|. | 1207 // Set up the parameters to load |data_url| with the specified |base_url|. |
1208 content::NavigationController::LoadURLParams load_params(data_gurl); | 1208 content::NavigationController::LoadURLParams load_params(data_gurl); |
1209 load_params.load_type = content::NavigationController::LOAD_TYPE_DATA; | 1209 load_params.load_type = content::NavigationController::LOAD_TYPE_DATA; |
1210 load_params.base_url_for_data_url = base_gurl; | 1210 load_params.base_url_for_data_url = base_gurl; |
1211 load_params.virtual_url_for_data_url = virtual_gurl; | 1211 load_params.virtual_url_for_data_url = virtual_gurl; |
1212 load_params.override_user_agent = | 1212 load_params.override_user_agent = |
1213 content::NavigationController::UA_OVERRIDE_INHERIT; | 1213 content::NavigationController::UA_OVERRIDE_INHERIT; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1484 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1485 DispatchEventToView( | 1485 DispatchEventToView( |
1486 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); | 1486 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); |
1487 } | 1487 } |
1488 // Since we changed fullscreen state, sending a Resize message ensures that | 1488 // Since we changed fullscreen state, sending a Resize message ensures that |
1489 // renderer/ sees the change. | 1489 // renderer/ sees the change. |
1490 web_contents()->GetRenderViewHost()->WasResized(); | 1490 web_contents()->GetRenderViewHost()->WasResized(); |
1491 } | 1491 } |
1492 | 1492 |
1493 } // namespace extensions | 1493 } // namespace extensions |
OLD | NEW |