| 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 "chrome/browser/guest_view/web_view/web_view_guest.h" | 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 static std::string TerminationStatusToString(base::TerminationStatus status) { | 105 static std::string TerminationStatusToString(base::TerminationStatus status) { |
| 106 switch (status) { | 106 switch (status) { |
| 107 case base::TERMINATION_STATUS_NORMAL_TERMINATION: | 107 case base::TERMINATION_STATUS_NORMAL_TERMINATION: |
| 108 return "normal"; | 108 return "normal"; |
| 109 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: | 109 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: |
| 110 case base::TERMINATION_STATUS_STILL_RUNNING: | 110 case base::TERMINATION_STATUS_STILL_RUNNING: |
| 111 return "abnormal"; | 111 return "abnormal"; |
| 112 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: | 112 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: |
| 113 return "killed"; | 113 return "killed"; |
| 114 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 114 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
| 115 #if defined(OS_ANDROID) | |
| 116 case base::TERMINATION_STATUS_OOM_PROTECTED: | |
| 117 #endif | |
| 118 return "crashed"; | 115 return "crashed"; |
| 119 case base::TERMINATION_STATUS_MAX_ENUM: | 116 case base::TERMINATION_STATUS_MAX_ENUM: |
| 120 break; | 117 break; |
| 121 } | 118 } |
| 122 NOTREACHED() << "Unknown Termination Status."; | 119 NOTREACHED() << "Unknown Termination Status."; |
| 123 return "unknown"; | 120 return "unknown"; |
| 124 } | 121 } |
| 125 | 122 |
| 126 static std::string PermissionTypeToString(WebViewPermissionType type) { | 123 static std::string PermissionTypeToString(WebViewPermissionType type) { |
| 127 switch (type) { | 124 switch (type) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 #endif // defined(ENABLE_FULL_PRINTING) | 179 #endif // defined(ENABLE_FULL_PRINTING) |
| 183 #endif // defined(ENABLE_PRINTING) | 180 #endif // defined(ENABLE_PRINTING) |
| 184 PDFTabHelper::CreateForWebContents(contents); | 181 PDFTabHelper::CreateForWebContents(contents); |
| 185 } | 182 } |
| 186 | 183 |
| 187 } // namespace | 184 } // namespace |
| 188 | 185 |
| 189 WebViewGuest::WebViewGuest(int guest_instance_id, | 186 WebViewGuest::WebViewGuest(int guest_instance_id, |
| 190 WebContents* guest_web_contents, | 187 WebContents* guest_web_contents, |
| 191 const std::string& embedder_extension_id) | 188 const std::string& embedder_extension_id) |
| 192 : GuestView<WebViewGuest>(guest_instance_id, | 189 : GuestView<WebViewGuest>(guest_instance_id, |
| 193 guest_web_contents, | 190 guest_web_contents, |
| 194 embedder_extension_id), | 191 embedder_extension_id), |
| 195 script_executor_(new extensions::ScriptExecutor(guest_web_contents, | 192 script_executor_(new extensions::ScriptExecutor(guest_web_contents, |
| 196 &script_observers_)), | 193 &script_observers_)), |
| 197 pending_context_menu_request_id_(0), | 194 pending_context_menu_request_id_(0), |
| 198 next_permission_request_id_(0), | 195 next_permission_request_id_(0), |
| 199 is_overriding_user_agent_(false), | 196 is_overriding_user_agent_(false), |
| 200 pending_reload_on_attachment_(false), | 197 pending_reload_on_attachment_(false), |
| 201 main_frame_id_(0), | 198 main_frame_id_(0), |
| 202 chromevox_injected_(false), | 199 chromevox_injected_(false), |
| 203 find_helper_(this), | 200 find_helper_(this), |
| 204 javascript_dialog_helper_(this) { | 201 javascript_dialog_helper_(this) { |
| 205 notification_registrar_.Add( | 202 notification_registrar_.Add( |
| 206 this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 203 this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 207 content::Source<WebContents>(guest_web_contents)); | 204 content::Source<WebContents>(guest_web_contents)); |
| 208 | 205 |
| 209 notification_registrar_.Add( | 206 notification_registrar_.Add( |
| 210 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 207 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
| 211 content::Source<WebContents>(guest_web_contents)); | 208 content::Source<WebContents>(guest_web_contents)); |
| 212 | 209 |
| 213 #if defined(OS_CHROMEOS) | 210 #if defined(OS_CHROMEOS) |
| 214 chromeos::AccessibilityManager* accessibility_manager = | 211 chromeos::AccessibilityManager* accessibility_manager = |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 bool allow, | 1588 bool allow, |
| 1592 const std::string& user_input) { | 1589 const std::string& user_input) { |
| 1593 WebViewGuest* guest = | 1590 WebViewGuest* guest = |
| 1594 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); | 1591 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); |
| 1595 if (!guest) | 1592 if (!guest) |
| 1596 return; | 1593 return; |
| 1597 | 1594 |
| 1598 if (!allow) | 1595 if (!allow) |
| 1599 guest->Destroy(); | 1596 guest->Destroy(); |
| 1600 } | 1597 } |
| OLD | NEW |