| 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/webrtc/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
| 28 #include "components/content_settings/core/browser/host_content_settings_map.h" | 28 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 29 #include "components/content_settings/core/common/content_settings_pattern.h" | 29 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 30 #include "components/pref_registry/pref_registry_syncable.h" | 30 #include "components/pref_registry/pref_registry_syncable.h" |
| 31 #include "components/prefs/scoped_user_pref_update.h" | 31 #include "components/prefs/scoped_user_pref_update.h" |
| 32 #include "components/url_formatter/elide_url.h" | 32 #include "components/url_formatter/elide_url.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/navigation_handle.h" |
| 34 #include "content/public/browser/render_frame_host.h" | 35 #include "content/public/browser/render_frame_host.h" |
| 35 #include "content/public/browser/render_process_host.h" | 36 #include "content/public/browser/render_process_host.h" |
| 36 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
| 37 #include "content/public/common/media_stream_request.h" | 38 #include "content/public/common/media_stream_request.h" |
| 38 #include "content/public/common/origin_util.h" | 39 #include "content/public/common/origin_util.h" |
| 39 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/gfx/vector_icons_public.h" | 42 #include "ui/gfx/vector_icons_public.h" |
| 42 | 43 |
| 43 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 GetRequestMap().erase(key_); | 134 GetRequestMap().erase(key_); |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 | 137 |
| 137 static RequestMap& GetRequestMap() { | 138 static RequestMap& GetRequestMap() { |
| 138 CR_DEFINE_STATIC_LOCAL(RequestMap, request_map, ()); | 139 CR_DEFINE_STATIC_LOCAL(RequestMap, request_map, ()); |
| 139 return request_map; | 140 return request_map; |
| 140 } | 141 } |
| 141 | 142 |
| 142 // content::WebContentsObserver overrides | 143 // content::WebContentsObserver overrides |
| 143 void DidNavigateAnyFrame( | 144 void DidFinishNavigation( |
| 144 content::RenderFrameHost* render_frame_host, | 145 content::NavigationHandle* navigation_handle) override { |
| 145 const content::LoadCommittedDetails& details, | 146 if (navigation_handle->HasCommitted()) |
| 146 const content::FrameNavigateParams& params) override { | 147 PageChanged(navigation_handle->GetRenderFrameHost()); |
| 147 PageChanged(render_frame_host); | |
| 148 } | 148 } |
| 149 | 149 |
| 150 void RenderFrameDeleted( | 150 void RenderFrameDeleted( |
| 151 content::RenderFrameHost* render_frame_host) override { | 151 content::RenderFrameHost* render_frame_host) override { |
| 152 PageChanged(render_frame_host); | 152 PageChanged(render_frame_host); |
| 153 } | 153 } |
| 154 | 154 |
| 155 RequestMap::key_type key_; | 155 RequestMap::key_type key_; |
| 156 }; | 156 }; |
| 157 | 157 |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (android_permission_blocked) | 622 if (android_permission_blocked) |
| 623 return false; | 623 return false; |
| 624 | 624 |
| 625 // Don't approve device requests if the tab was hidden. | 625 // Don't approve device requests if the tab was hidden. |
| 626 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 626 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 627 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 627 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 628 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 628 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 629 #endif | 629 #endif |
| 630 return true; | 630 return true; |
| 631 } | 631 } |
| OLD | NEW |