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 "components/guest_view/browser/guest_view_manager.h" | 5 #include "components/guest_view/browser/guest_view_manager.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/metrics/user_metrics.h" |
11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
12 #include "components/guest_view/browser/guest_view_base.h" | 13 #include "components/guest_view/browser/guest_view_base.h" |
13 #include "components/guest_view/browser/guest_view_manager_delegate.h" | 14 #include "components/guest_view/browser/guest_view_manager_delegate.h" |
14 #include "components/guest_view/browser/guest_view_manager_factory.h" | 15 #include "components/guest_view/browser/guest_view_manager_factory.h" |
15 #include "components/guest_view/common/guest_view_constants.h" | 16 #include "components/guest_view/common/guest_view_constants.h" |
16 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
17 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
18 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
19 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
20 #include "content/public/browser/user_metrics.h" | |
21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
22 #include "content/public/common/child_process_host.h" | 22 #include "content/public/common/child_process_host.h" |
23 #include "content/public/common/result_codes.h" | 23 #include "content/public/common/result_codes.h" |
24 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 using content::BrowserContext; | 27 using content::BrowserContext; |
28 using content::RenderProcessHost; | 28 using content::RenderProcessHost; |
29 using content::SiteInstance; | 29 using content::SiteInstance; |
30 using content::WebContents; | 30 using content::WebContents; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 return nullptr; | 404 return nullptr; |
405 return it->second; | 405 return it->second; |
406 } | 406 } |
407 | 407 |
408 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( | 408 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( |
409 int embedder_render_process_id, | 409 int embedder_render_process_id, |
410 int guest_instance_id) { | 410 int guest_instance_id) { |
411 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, | 411 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, |
412 guest_instance_id)) { | 412 guest_instance_id)) { |
413 // The embedder process is trying to access a guest it does not own. | 413 // The embedder process is trying to access a guest it does not own. |
414 content::RecordAction( | 414 base::RecordAction(base::UserMetricsAction("BadMessageTerminate_BPGM")); |
415 base::UserMetricsAction("BadMessageTerminate_BPGM")); | |
416 content::RenderProcessHost::FromID(embedder_render_process_id) | 415 content::RenderProcessHost::FromID(embedder_render_process_id) |
417 ->Shutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | 416 ->Shutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false); |
418 return false; | 417 return false; |
419 } | 418 } |
420 return true; | 419 return true; |
421 } | 420 } |
422 | 421 |
423 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { | 422 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { |
424 if (guest_instance_id <= last_instance_id_removed_) | 423 if (guest_instance_id <= last_instance_id_removed_) |
425 return false; | 424 return false; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 const GuestViewCreateFunction& create_function, | 502 const GuestViewCreateFunction& create_function, |
504 const GuestViewCleanUpFunction& cleanup_function) | 503 const GuestViewCleanUpFunction& cleanup_function) |
505 : create_function(create_function), cleanup_function(cleanup_function) {} | 504 : create_function(create_function), cleanup_function(cleanup_function) {} |
506 | 505 |
507 GuestViewManager::GuestViewData::GuestViewData(const GuestViewData& other) = | 506 GuestViewManager::GuestViewData::GuestViewData(const GuestViewData& other) = |
508 default; | 507 default; |
509 | 508 |
510 GuestViewManager::GuestViewData::~GuestViewData() {} | 509 GuestViewManager::GuestViewData::~GuestViewData() {} |
511 | 510 |
512 } // namespace guest_view | 511 } // namespace guest_view |
OLD | NEW |