OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/media_stream_devices_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 using RequestMap = std::map<std::pair<int, int>, | 108 using RequestMap = std::map<std::pair<int, int>, |
109 std::unique_ptr<MediaPermissionRequestLogger>>; | 109 std::unique_ptr<MediaPermissionRequestLogger>>; |
110 | 110 |
111 public: | 111 public: |
112 static void LogRequest(content::WebContents* contents, | 112 static void LogRequest(content::WebContents* contents, |
113 int render_process_id, | 113 int render_process_id, |
114 int render_frame_id, | 114 int render_frame_id, |
115 bool is_secure) { | 115 bool is_secure) { |
116 RequestMap::key_type key = | 116 RequestMap::key_type key = |
117 std::make_pair(render_process_id, render_frame_id); | 117 std::make_pair(render_process_id, render_frame_id); |
118 if (!ContainsKey(GetRequestMap(), key)) { | 118 if (!base::ContainsKey(GetRequestMap(), key)) { |
119 UMA_HISTOGRAM_BOOLEAN("Pepper.SecureOrigin.MediaStreamRequest", | 119 UMA_HISTOGRAM_BOOLEAN("Pepper.SecureOrigin.MediaStreamRequest", |
120 is_secure); | 120 is_secure); |
121 GetRequestMap()[key] = | 121 GetRequestMap()[key] = |
122 base::WrapUnique(new MediaPermissionRequestLogger(contents, key)); | 122 base::WrapUnique(new MediaPermissionRequestLogger(contents, key)); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 MediaPermissionRequestLogger(content::WebContents* contents, | 127 MediaPermissionRequestLogger(content::WebContents* contents, |
128 RequestMap::key_type key) | 128 RequestMap::key_type key) |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 if (android_permission_blocked) | 640 if (android_permission_blocked) |
641 return false; | 641 return false; |
642 | 642 |
643 // Don't approve device requests if the tab was hidden. | 643 // Don't approve device requests if the tab was hidden. |
644 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 644 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
645 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 645 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
646 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 646 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
647 #endif | 647 #endif |
648 return true; | 648 return true; |
649 } | 649 } |
OLD | NEW |