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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 error_ = kNoUrlError; | 99 error_ = kNoUrlError; |
100 return false; | 100 return false; |
101 } | 101 } |
102 origin_ = GURL(*(params->target_tab->url)).GetOrigin(); | 102 origin_ = GURL(*(params->target_tab->url)).GetOrigin(); |
103 | 103 |
104 if (!origin_.is_valid()) { | 104 if (!origin_.is_valid()) { |
105 error_ = kInvalidOriginError; | 105 error_ = kInvalidOriginError; |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 109 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
110 switches::kAllowHttpScreenCapture) && | 110 switches::kAllowHttpScreenCapture) && |
111 !origin_.SchemeIsSecure()) { | 111 !origin_.SchemeIsSecure()) { |
112 error_ = kTabUrlNotSecure; | 112 error_ = kTabUrlNotSecure; |
113 return false; | 113 return false; |
114 } | 114 } |
115 target_name = base::UTF8ToUTF16(origin_.SchemeIsSecure() ? | 115 target_name = base::UTF8ToUTF16(origin_.SchemeIsSecure() ? |
116 net::GetHostAndOptionalPort(origin_) : origin_.spec()); | 116 net::GetHostAndOptionalPort(origin_) : origin_.spec()); |
117 | 117 |
118 if (!params->target_tab->id) { | 118 if (!params->target_tab->id) { |
119 error_ = kNoTabIdError; | 119 error_ = kNoTabIdError; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 298 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
299 int request_id) { | 299 int request_id) { |
300 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 300 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
301 if (it != requests_.end()) | 301 if (it != requests_.end()) |
302 it->second->Cancel(); | 302 it->second->Cancel(); |
303 } | 303 } |
304 | 304 |
305 | 305 |
306 } // namespace extensions | 306 } // namespace extensions |
OLD | NEW |