OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/desktop_capture/desktop_capture_api.h" | 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
10 #include "chrome/browser/media/desktop_media_list_ash.h" | 10 #include "chrome/browser/media/desktop_media_list_ash.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return false; | 93 return false; |
94 } | 94 } |
95 origin_ = GURL(*(params->target_tab->url)).GetOrigin(); | 95 origin_ = GURL(*(params->target_tab->url)).GetOrigin(); |
96 | 96 |
97 if (!params->target_tab->id) { | 97 if (!params->target_tab->id) { |
98 error_ = kNoTabIdError; | 98 error_ = kNoTabIdError; |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 content::WebContents* web_contents = NULL; | 102 content::WebContents* web_contents = NULL; |
103 if (!ExtensionTabUtil::GetTabById(*(params->target_tab->id), | 103 if (!ExtensionTabUtil::GetTabById(*(params->target_tab->id), GetProfile(), |
104 GetProfile(), | 104 true, NULL, NULL, &web_contents, NULL)) { |
105 false, | |
106 NULL, | |
107 NULL, | |
108 &web_contents, | |
109 NULL)) { | |
110 error_ = kInvalidTabIdError; | 105 error_ = kInvalidTabIdError; |
111 return false; | 106 return false; |
112 } | 107 } |
113 | 108 |
114 GURL current_origin_ = | 109 GURL current_origin_ = |
115 web_contents->GetLastCommittedURL().GetOrigin(); | 110 web_contents->GetLastCommittedURL().GetOrigin(); |
116 if (current_origin_ != origin_) { | 111 if (current_origin_ != origin_) { |
117 error_ = kTabUrlChangedError; | 112 error_ = kTabUrlChangedError; |
118 return false; | 113 return false; |
119 } | 114 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 266 |
272 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 267 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
273 int request_id) { | 268 int request_id) { |
274 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 269 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
275 if (it != requests_.end()) | 270 if (it != requests_.end()) |
276 it->second->Cancel(); | 271 it->second->Cancel(); |
277 } | 272 } |
278 | 273 |
279 | 274 |
280 } // namespace extensions | 275 } // namespace extensions |
OLD | NEW |