| 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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 virtual void RespondImpl(bool should_allow, | 173 virtual void RespondImpl(bool should_allow, |
| 174 const std::string& user_input) OVERRIDE { | 174 const std::string& user_input) OVERRIDE { |
| 175 WebContentsImpl* web_contents = guest_->embedder_web_contents(); | 175 WebContentsImpl* web_contents = guest_->embedder_web_contents(); |
| 176 if (should_allow && web_contents) { | 176 if (should_allow && web_contents) { |
| 177 // Re-route the request to the embedder's WebContents; the guest gets the | 177 // Re-route the request to the embedder's WebContents; the guest gets the |
| 178 // permission this way. | 178 // permission this way. |
| 179 web_contents->RequestMediaAccessPermission(request_, callback_); | 179 web_contents->RequestMediaAccessPermission(request_, callback_); |
| 180 } else { | 180 } else { |
| 181 // Deny the request. | 181 // Deny the request. |
| 182 callback_.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); | 182 callback_.Run(MediaStreamDevices(), |
| 183 content::INVALID_STATE, |
| 184 scoped_ptr<MediaStreamUI>()); |
| 183 } | 185 } |
| 184 } | 186 } |
| 185 | 187 |
| 186 private: | 188 private: |
| 187 virtual ~MediaRequest() {} | 189 virtual ~MediaRequest() {} |
| 188 MediaStreamRequest request_; | 190 MediaStreamRequest request_; |
| 189 MediaResponseCallback callback_; | 191 MediaResponseCallback callback_; |
| 190 }; | 192 }; |
| 191 | 193 |
| 192 class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { | 194 class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 base::Value::CreateStringValue(request_method)); | 1917 base::Value::CreateStringValue(request_method)); |
| 1916 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1918 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
| 1917 | 1919 |
| 1918 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1920 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
| 1919 new DownloadRequest(weak_ptr_factory_.GetWeakPtr(), | 1921 new DownloadRequest(weak_ptr_factory_.GetWeakPtr(), |
| 1920 callback), | 1922 callback), |
| 1921 request_info); | 1923 request_info); |
| 1922 } | 1924 } |
| 1923 | 1925 |
| 1924 } // namespace content | 1926 } // namespace content |
| OLD | NEW |