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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 96 mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
97 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_WEBSQL) | 97 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_WEBSQL) |
98 mask |= StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 98 mask |= StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
99 | 99 |
100 return mask; | 100 return mask; |
101 } | 101 } |
102 | 102 |
103 std::string WindowOpenDispositionToString( | 103 std::string WindowOpenDispositionToString( |
104 WindowOpenDisposition window_open_disposition) { | 104 WindowOpenDisposition window_open_disposition) { |
105 switch (window_open_disposition) { | 105 switch (window_open_disposition) { |
106 case IGNORE_ACTION: | 106 case WindowOpenDisposition::IGNORE_ACTION: |
107 return "ignore"; | 107 return "ignore"; |
108 case SAVE_TO_DISK: | 108 case WindowOpenDisposition::SAVE_TO_DISK: |
109 return "save_to_disk"; | 109 return "save_to_disk"; |
110 case CURRENT_TAB: | 110 case WindowOpenDisposition::CURRENT_TAB: |
111 return "current_tab"; | 111 return "current_tab"; |
112 case NEW_BACKGROUND_TAB: | 112 case WindowOpenDisposition::NEW_BACKGROUND_TAB: |
113 return "new_background_tab"; | 113 return "new_background_tab"; |
114 case NEW_FOREGROUND_TAB: | 114 case WindowOpenDisposition::NEW_FOREGROUND_TAB: |
115 return "new_foreground_tab"; | 115 return "new_foreground_tab"; |
116 case NEW_WINDOW: | 116 case WindowOpenDisposition::NEW_WINDOW: |
117 return "new_window"; | 117 return "new_window"; |
118 case NEW_POPUP: | 118 case WindowOpenDisposition::NEW_POPUP: |
119 return "new_popup"; | 119 return "new_popup"; |
120 default: | 120 default: |
121 NOTREACHED() << "Unknown Window Open Disposition"; | 121 NOTREACHED() << "Unknown Window Open Disposition"; |
122 return "ignore"; | 122 return "ignore"; |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 static std::string TerminationStatusToString(base::TerminationStatus status) { | 126 static std::string TerminationStatusToString(base::TerminationStatus status) { |
127 switch (status) { | 127 switch (status) { |
128 case base::TERMINATION_STATUS_NORMAL_TERMINATION: | 128 case base::TERMINATION_STATUS_NORMAL_TERMINATION: |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 // LoadURLWithParams.) | 1266 // LoadURLWithParams.) |
1267 // | 1267 // |
1268 // We make an exception here for context menu items, since the Language | 1268 // We make an exception here for context menu items, since the Language |
1269 // Settings item uses a browser-initiated navigation to a chrome:// URL. | 1269 // Settings item uses a browser-initiated navigation to a chrome:// URL. |
1270 // These can be passed to the embedder's WebContentsDelegate so that the | 1270 // These can be passed to the embedder's WebContentsDelegate so that the |
1271 // browser performs the action for the <webview>. Navigations to a new | 1271 // browser performs the action for the <webview>. Navigations to a new |
1272 // tab, etc., are also handled by the WebContentsDelegate. | 1272 // tab, etc., are also handled by the WebContentsDelegate. |
1273 if (!params.is_renderer_initiated && | 1273 if (!params.is_renderer_initiated && |
1274 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 1274 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
1275 params.url.scheme()) || | 1275 params.url.scheme()) || |
1276 params.disposition != CURRENT_TAB)) { | 1276 params.disposition != WindowOpenDisposition::CURRENT_TAB)) { |
1277 if (!owner_web_contents()->GetDelegate()) | 1277 if (!owner_web_contents()->GetDelegate()) |
1278 return nullptr; | 1278 return nullptr; |
1279 return owner_web_contents()->GetDelegate()->OpenURLFromTab( | 1279 return owner_web_contents()->GetDelegate()->OpenURLFromTab( |
1280 owner_web_contents(), params); | 1280 owner_web_contents(), params); |
1281 } | 1281 } |
1282 | 1282 |
1283 if (!attached()) { | 1283 if (!attached()) { |
1284 WebViewGuest* opener = GetOpener(); | 1284 WebViewGuest* opener = GetOpener(); |
1285 // If the guest wishes to navigate away prior to attachment then we save the | 1285 // If the guest wishes to navigate away prior to attachment then we save the |
1286 // navigation to perform upon attachment. Navigation initializes a lot of | 1286 // navigation to perform upon attachment. Navigation initializes a lot of |
(...skipping 15 matching lines...) Expand all Loading... |
1302 | 1302 |
1303 // This code path is taken if RenderFrameImpl::DecidePolicyForNavigation | 1303 // This code path is taken if RenderFrameImpl::DecidePolicyForNavigation |
1304 // decides that a fork should happen. At the time of writing this comment, | 1304 // decides that a fork should happen. At the time of writing this comment, |
1305 // the only way a well behaving guest could hit this code path is if it | 1305 // the only way a well behaving guest could hit this code path is if it |
1306 // navigates to a URL that's associated with the default search engine. | 1306 // navigates to a URL that's associated with the default search engine. |
1307 // This list of URLs is generated by search::GetSearchURLs. Validity checks | 1307 // This list of URLs is generated by search::GetSearchURLs. Validity checks |
1308 // are performed inside LoadURLWithParams such that if the guest attempts | 1308 // are performed inside LoadURLWithParams such that if the guest attempts |
1309 // to navigate to a URL that it is not allowed to navigate to, a 'loadabort' | 1309 // to navigate to a URL that it is not allowed to navigate to, a 'loadabort' |
1310 // event will fire in the embedder, and the guest will be navigated to | 1310 // event will fire in the embedder, and the guest will be navigated to |
1311 // about:blank. | 1311 // about:blank. |
1312 if (params.disposition == CURRENT_TAB) { | 1312 if (params.disposition == WindowOpenDisposition::CURRENT_TAB) { |
1313 LoadURLWithParams(params.url, params.referrer, params.transition, | 1313 LoadURLWithParams(params.url, params.referrer, params.transition, |
1314 true /* force_navigation */); | 1314 true /* force_navigation */); |
1315 return web_contents(); | 1315 return web_contents(); |
1316 } | 1316 } |
1317 | 1317 |
1318 // This code path is taken if Ctrl+Click, middle click or any of the | 1318 // This code path is taken if Ctrl+Click, middle click or any of the |
1319 // keyboard/mouse combinations are used to open a link in a new tab/window. | 1319 // keyboard/mouse combinations are used to open a link in a new tab/window. |
1320 // This code path is also taken on client-side redirects from about:blank. | 1320 // This code path is also taken on client-side redirects from about:blank. |
1321 CreateNewGuestWebViewWindow(params); | 1321 CreateNewGuestWebViewWindow(params); |
1322 return nullptr; | 1322 return nullptr; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1507 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1508 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 1508 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
1509 webview::kEventExitFullscreen, std::move(args))); | 1509 webview::kEventExitFullscreen, std::move(args))); |
1510 } | 1510 } |
1511 // Since we changed fullscreen state, sending a Resize message ensures that | 1511 // Since we changed fullscreen state, sending a Resize message ensures that |
1512 // renderer/ sees the change. | 1512 // renderer/ sees the change. |
1513 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1513 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
1514 } | 1514 } |
1515 | 1515 |
1516 } // namespace extensions | 1516 } // namespace extensions |
OLD | NEW |