| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return "mimeHandlerViewGuestInternal"; | 49 return "mimeHandlerViewGuestInternal"; |
| 50 } | 50 } |
| 51 | 51 |
| 52 int MimeHandlerViewGuest::GetTaskPrefix() const { | 52 int MimeHandlerViewGuest::GetTaskPrefix() const { |
| 53 return IDS_EXTENSION_TASK_MANAGER_MIMEHANDLERVIEW_TAG_PREFIX; | 53 return IDS_EXTENSION_TASK_MANAGER_MIMEHANDLERVIEW_TAG_PREFIX; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void MimeHandlerViewGuest::CreateWebContents( | 56 void MimeHandlerViewGuest::CreateWebContents( |
| 57 const std::string& embedder_extension_id, | 57 const std::string& embedder_extension_id, |
| 58 int embedder_render_process_id, | 58 int embedder_render_process_id, |
| 59 const GURL& embedder_site_url, |
| 59 const base::DictionaryValue& create_params, | 60 const base::DictionaryValue& create_params, |
| 60 const WebContentsCreatedCallback& callback) { | 61 const WebContentsCreatedCallback& callback) { |
| 61 std::string orig_mime_type; | 62 std::string orig_mime_type; |
| 62 bool success = | 63 bool success = |
| 63 create_params.GetString(mime_handler_view::kMimeType, &orig_mime_type); | 64 create_params.GetString(mime_handler_view::kMimeType, &orig_mime_type); |
| 64 DCHECK(success && !orig_mime_type.empty()); | 65 DCHECK(success && !orig_mime_type.empty()); |
| 65 std::string guest_site_str; | 66 std::string guest_site_str; |
| 66 // Note that we put a prefix "mime-" before the mime type so that this | 67 // Note that we put a prefix "mime-" before the mime type so that this |
| 67 // can never collide with an extension ID. | 68 // can never collide with an extension ID. |
| 68 guest_site_str = base::StringPrintf( | 69 guest_site_str = base::StringPrintf( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard | 114 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard |
| 114 // events because the guest may be arbitrarily delayed when responding to | 115 // events because the guest may be arbitrarily delayed when responding to |
| 115 // keyboard events. In that time, the embedder may have received and processed | 116 // keyboard events. In that time, the embedder may have received and processed |
| 116 // additional key events. This needs to be fixed as soon as possible. | 117 // additional key events. This needs to be fixed as soon as possible. |
| 117 // See http://crbug.com/229882. | 118 // See http://crbug.com/229882. |
| 118 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), | 119 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), |
| 119 event); | 120 event); |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |