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

Side by Side Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 1133003003: Fix copying from interstitial pages on OSX by going through the RenderWidgetHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Nasko's comments. Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/interstitial_page_impl.h" 5 #include "content/browser/frame_host/interstitial_page_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
17 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" 17 #include "content/browser/frame_host/interstitial_page_navigator_impl.h"
18 #include "content/browser/frame_host/navigation_controller_impl.h" 18 #include "content/browser/frame_host/navigation_controller_impl.h"
19 #include "content/browser/frame_host/navigation_entry_impl.h" 19 #include "content/browser/frame_host/navigation_entry_impl.h"
20 #include "content/browser/loader/resource_dispatcher_host_impl.h" 20 #include "content/browser/loader/resource_dispatcher_host_impl.h"
21 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
22 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 22 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
23 #include "content/browser/renderer_host/render_view_host_factory.h" 23 #include "content/browser/renderer_host/render_view_host_factory.h"
24 #include "content/browser/renderer_host/render_view_host_impl.h" 24 #include "content/browser/renderer_host/render_view_host_impl.h"
25 #include "content/browser/renderer_host/render_widget_host_view_base.h" 25 #include "content/browser/renderer_host/render_widget_host_view_base.h"
26 #include "content/browser/site_instance_impl.h" 26 #include "content/browser/site_instance_impl.h"
27 #include "content/browser/web_contents/web_contents_impl.h" 27 #include "content/browser/web_contents/web_contents_impl.h"
28 #include "content/browser/web_contents/web_contents_view.h" 28 #include "content/browser/web_contents/web_contents_view.h"
29 #include "content/common/frame_messages.h" 29 #include "content/common/frame_messages.h"
30 #include "content/common/input_messages.h"
30 #include "content/common/view_messages.h" 31 #include "content/common/view_messages.h"
31 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
32 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/content_browser_client.h" 34 #include "content/public/browser/content_browser_client.h"
34 #include "content/public/browser/dom_operation_notification_details.h" 35 #include "content/public/browser/dom_operation_notification_details.h"
35 #include "content/public/browser/interstitial_page_delegate.h" 36 #include "content/public/browser/interstitial_page_delegate.h"
36 #include "content/public/browser/invalidate_type.h" 37 #include "content/public/browser/invalidate_type.h"
37 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/storage_partition.h" 40 #include "content/public/browser/storage_partition.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // It would be inconsistent to create an interstitial with no new navigation 184 // It would be inconsistent to create an interstitial with no new navigation
184 // (which is the case when the interstitial was triggered by a sub-resource on 185 // (which is the case when the interstitial was triggered by a sub-resource on
185 // a page) when we have a pending entry (in the process of loading a new top 186 // a page) when we have a pending entry (in the process of loading a new top
186 // frame). 187 // frame).
187 DCHECK(new_navigation || !web_contents->GetController().GetPendingEntry()); 188 DCHECK(new_navigation || !web_contents->GetController().GetPendingEntry());
188 } 189 }
189 190
190 InterstitialPageImpl::~InterstitialPageImpl() { 191 InterstitialPageImpl::~InterstitialPageImpl() {
191 } 192 }
192 193
194 void InterstitialPageImpl::Undo() {
195 RenderFrameHostImpl* focused_frame =
196 frame_tree_.GetFocusedFrame()->current_frame_host();
197 if (!focused_frame)
198 return;
199
200 focused_frame->Send(new InputMsg_Undo(focused_frame->GetRoutingID()));
201 RecordAction(base::UserMetricsAction("Undo"));
202 }
203
204 void InterstitialPageImpl::Redo() {
205 RenderFrameHostImpl* focused_frame =
206 frame_tree_.GetFocusedFrame()->current_frame_host();
207 if (!focused_frame)
208 return;
209
210 focused_frame->Send(new InputMsg_Redo(focused_frame->GetRoutingID()));
211 RecordAction(base::UserMetricsAction("Redo"));
212 }
213
214 void InterstitialPageImpl::Cut() {
215 RenderFrameHostImpl* focused_frame =
216 frame_tree_.GetFocusedFrame()->current_frame_host();
217 if (!focused_frame)
218 return;
219
220 focused_frame->Send(new InputMsg_Cut(focused_frame->GetRoutingID()));
221 RecordAction(base::UserMetricsAction("Cut"));
222 }
223
224 void InterstitialPageImpl::Copy() {
225 RenderFrameHostImpl* focused_frame =
226 frame_tree_.GetFocusedFrame()->current_frame_host();
227 if (!focused_frame)
228 return;
229
230 focused_frame->Send(new InputMsg_Copy(focused_frame->GetRoutingID()));
231 RecordAction(base::UserMetricsAction("Copy"));
232 }
233
234 void InterstitialPageImpl::CopyToFindPboard() {
235 #if defined(OS_MACOSX)
236 RenderFrameHostImpl* focused_frame =
237 frame_tree_.GetFocusedFrame()->current_frame_host();
238 if (!focused_frame)
239 return;
240
241 // Windows/Linux don't have the concept of a find pasteboard.
242 focused_frame->Send(
243 new InputMsg_CopyToFindPboard(focused_frame->GetRoutingID()));
244 RecordAction(base::UserMetricsAction("CopyToFindPboard"));
245 #endif
246 }
247
248 void InterstitialPageImpl::Paste() {
249 RenderFrameHostImpl* focused_frame =
250 frame_tree_.GetFocusedFrame()->current_frame_host();
251 if (!focused_frame)
252 return;
253
254 focused_frame->Send(new InputMsg_Paste(focused_frame->GetRoutingID()));
255 RecordAction(base::UserMetricsAction("Paste"));
256 }
257
258 void InterstitialPageImpl::PasteAndMatchStyle() {
259 RenderFrameHostImpl* focused_frame =
260 frame_tree_.GetFocusedFrame()->current_frame_host();
261 if (!focused_frame)
262 return;
263
264 focused_frame->Send(
265 new InputMsg_PasteAndMatchStyle(focused_frame->GetRoutingID()));
266 RecordAction(base::UserMetricsAction("PasteAndMatchStyle"));
267 }
268
269 void InterstitialPageImpl::SelectAll() {
270 RenderFrameHostImpl* focused_frame =
271 frame_tree_.GetFocusedFrame()->current_frame_host();
272 if (!focused_frame)
273 return;
274
275 focused_frame->Send(new InputMsg_SelectAll(focused_frame->GetRoutingID()));
276 RecordAction(base::UserMetricsAction("SelectAll"));
277 }
278
193 void InterstitialPageImpl::Show() { 279 void InterstitialPageImpl::Show() {
194 if (!enabled()) 280 if (!enabled())
195 return; 281 return;
196 282
197 // If an interstitial is already showing or about to be shown, close it before 283 // If an interstitial is already showing or about to be shown, close it before
198 // showing the new one. 284 // showing the new one.
199 // Be careful not to take an action on the old interstitial more than once. 285 // Be careful not to take an action on the old interstitial more than once.
200 InterstitialPageMap::const_iterator iter = 286 InterstitialPageMap::const_iterator iter =
201 g_web_contents_to_interstitial_page->find(web_contents_); 287 g_web_contents_to_interstitial_page->find(web_contents_);
202 if (iter != g_web_contents_to_interstitial_page->end()) { 288 if (iter != g_web_contents_to_interstitial_page->end()) {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( 979 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted(
894 const LoadCommittedDetails& load_details) { 980 const LoadCommittedDetails& load_details) {
895 interstitial_->OnNavigatingAwayOrTabClosing(); 981 interstitial_->OnNavigatingAwayOrTabClosing();
896 } 982 }
897 983
898 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { 984 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() {
899 interstitial_->OnNavigatingAwayOrTabClosing(); 985 interstitial_->OnNavigatingAwayOrTabClosing();
900 } 986 }
901 987
902 } // namespace content 988 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698