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

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 2417693002: Allow MimeHandlerViewGuest be embedded inside OOPIFs (Closed)
Patch Set: Setting embedder frame id when the MimeHandlerViewGuest is created. Created 4 years, 2 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 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/mime_handler_view/mime_handler_view_gues t.h" 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "components/guest_view/common/guest_view_constants.h" 10 #include "components/guest_view/common/guest_view_constants.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // static 69 // static
70 const char MimeHandlerViewGuest::Type[] = "mimehandler"; 70 const char MimeHandlerViewGuest::Type[] = "mimehandler";
71 71
72 // static 72 // static
73 GuestViewBase* MimeHandlerViewGuest::Create(WebContents* owner_web_contents) { 73 GuestViewBase* MimeHandlerViewGuest::Create(WebContents* owner_web_contents) {
74 return new MimeHandlerViewGuest(owner_web_contents); 74 return new MimeHandlerViewGuest(owner_web_contents);
75 } 75 }
76 76
77 MimeHandlerViewGuest::MimeHandlerViewGuest(WebContents* owner_web_contents) 77 MimeHandlerViewGuest::MimeHandlerViewGuest(WebContents* owner_web_contents)
78 : GuestView<MimeHandlerViewGuest>(owner_web_contents), 78 : GuestView<MimeHandlerViewGuest>(owner_web_contents),
79 delegate_(ExtensionsAPIClient::Get()->CreateMimeHandlerViewGuestDelegate( 79 delegate_(
80 this)) {} 80 ExtensionsAPIClient::Get()->CreateMimeHandlerViewGuestDelegate(this)),
81 embedder_frame_process_id_(0),
82 embedder_frame_routing_id_(MSG_ROUTING_NONE) {}
81 83
82 MimeHandlerViewGuest::~MimeHandlerViewGuest() { 84 MimeHandlerViewGuest::~MimeHandlerViewGuest() {
83 } 85 }
84 86
85 bool MimeHandlerViewGuest::CanUseCrossProcessFrames() { 87 bool MimeHandlerViewGuest::CanUseCrossProcessFrames() {
86 return false; 88 return false;
87 } 89 }
88 90
91 content::RenderFrameHost* MimeHandlerViewGuest::GetEmbedderFrame() {
92 if (embedder_frame_routing_id_ != MSG_ROUTING_NONE)
93 return content::RenderFrameHost::FromID(embedder_frame_process_id_,
94 embedder_frame_routing_id_);
95 return GuestViewBase::GetEmbedderFrame();
96 }
97
98 void MimeHandlerViewGuest::SetEmbedderFrame(int process_id, int routing_id) {
99 DCHECK_NE(routing_id, MSG_ROUTING_NONE);
100 DCHECK_EQ(embedder_frame_routing_id_, MSG_ROUTING_NONE);
101
102 embedder_frame_process_id_ = process_id;
103 embedder_frame_routing_id_ = routing_id;
wjmaclean 2016/10/20 14:47:22 Do we need to do anything with these values when d
EhsanK 2016/10/20 21:41:18 We could reset to 0 and MSG_ROUTING_NONE. But Mime
104 }
105
89 const char* MimeHandlerViewGuest::GetAPINamespace() const { 106 const char* MimeHandlerViewGuest::GetAPINamespace() const {
90 return "mimeHandlerViewGuestInternal"; 107 return "mimeHandlerViewGuestInternal";
91 } 108 }
92 109
93 int MimeHandlerViewGuest::GetTaskPrefix() const { 110 int MimeHandlerViewGuest::GetTaskPrefix() const {
94 return IDS_EXTENSION_TASK_MANAGER_MIMEHANDLERVIEW_TAG_PREFIX; 111 return IDS_EXTENSION_TASK_MANAGER_MIMEHANDLERVIEW_TAG_PREFIX;
95 } 112 }
96 113
97 void MimeHandlerViewGuest::CreateWebContents( 114 void MimeHandlerViewGuest::CreateWebContents(
98 const base::DictionaryValue& create_params, 115 const base::DictionaryValue& create_params,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 element_instance_id())); 266 element_instance_id()));
250 } 267 }
251 268
252 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { 269 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const {
253 if (!stream_) 270 if (!stream_)
254 return base::WeakPtr<StreamContainer>(); 271 return base::WeakPtr<StreamContainer>();
255 return stream_->GetWeakPtr(); 272 return stream_->GetWeakPtr();
256 } 273 }
257 274
258 } // namespace extensions 275 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698