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/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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 callback.Run(WebContents::Create(params)); | 102 callback.Run(WebContents::Create(params)); |
103 } | 103 } |
104 | 104 |
105 void MimeHandlerViewGuest::DidAttachToEmbedder() { | 105 void MimeHandlerViewGuest::DidAttachToEmbedder() { |
106 std::string src; | 106 std::string src; |
107 bool success = attach_params()->GetString(mime_handler_view::kSrc, &src); | 107 bool success = attach_params()->GetString(mime_handler_view::kSrc, &src); |
108 DCHECK(success && !src.empty()); | 108 DCHECK(success && !src.empty()); |
109 web_contents()->GetController().LoadURL( | 109 web_contents()->GetController().LoadURL( |
110 GURL(src), | 110 GURL(src), |
111 content::Referrer(), | 111 content::Referrer(), |
112 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 112 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
113 std::string()); | 113 std::string()); |
114 } | 114 } |
115 | 115 |
116 void MimeHandlerViewGuest::DidInitialize() { | 116 void MimeHandlerViewGuest::DidInitialize() { |
117 if (delegate_) | 117 if (delegate_) |
118 delegate_->AttachHelpers(); | 118 delegate_->AttachHelpers(); |
119 } | 119 } |
120 | 120 |
121 void MimeHandlerViewGuest::HandleKeyboardEvent( | 121 void MimeHandlerViewGuest::HandleKeyboardEvent( |
122 WebContents* source, | 122 WebContents* source, |
123 const content::NativeWebKeyboardEvent& event) { | 123 const content::NativeWebKeyboardEvent& event) { |
124 if (!attached()) | 124 if (!attached()) |
125 return; | 125 return; |
126 | 126 |
127 // Send the keyboard events back to the embedder to reprocess them. | 127 // Send the keyboard events back to the embedder to reprocess them. |
128 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard | 128 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard |
129 // events because the guest may be arbitrarily delayed when responding to | 129 // events because the guest may be arbitrarily delayed when responding to |
130 // keyboard events. In that time, the embedder may have received and processed | 130 // keyboard events. In that time, the embedder may have received and processed |
131 // additional key events. This needs to be fixed as soon as possible. | 131 // additional key events. This needs to be fixed as soon as possible. |
132 // See http://crbug.com/229882. | 132 // See http://crbug.com/229882. |
133 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), | 133 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), |
134 event); | 134 event); |
135 } | 135 } |
136 | 136 |
137 } // namespace extensions | 137 } // namespace extensions |
OLD | NEW |