| 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 // Implements the Chrome Extensions Tab Capture API. | 5 // Implements the Chrome Extensions Tab Capture API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h" | 7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 "pkedcjkdefgpdelpbcmbmeomcjbeemfm", // Stable | 197 "pkedcjkdefgpdelpbcmbmeomcjbeemfm", // Stable |
| 198 "ekpaaapppgpmolpcldedioblbkmijaca", // Beta | 198 "ekpaaapppgpmolpcldedioblbkmijaca", // Beta |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 bool TabCaptureCaptureFunction::RunSync() { | 201 bool TabCaptureCaptureFunction::RunSync() { |
| 202 scoped_ptr<api::tab_capture::Capture::Params> params = | 202 scoped_ptr<api::tab_capture::Capture::Params> params = |
| 203 TabCapture::Capture::Params::Create(*args_); | 203 TabCapture::Capture::Params::Create(*args_); |
| 204 EXTENSION_FUNCTION_VALIDATE(params); | 204 EXTENSION_FUNCTION_VALIDATE(params); |
| 205 | 205 |
| 206 // Figure out the active WebContents and retrieve the needed ids. | 206 // Figure out the active WebContents and retrieve the needed ids. |
| 207 Browser* target_browser = chrome::FindAnyBrowser( | 207 Browser* target_browser = |
| 208 GetProfile(), include_incognito(), chrome::GetActiveDesktop()); | 208 chrome::FindAnyBrowser(GetProfile(), include_incognito()); |
| 209 if (!target_browser) { | 209 if (!target_browser) { |
| 210 error_ = kFindingTabError; | 210 error_ = kFindingTabError; |
| 211 return false; | 211 return false; |
| 212 } | 212 } |
| 213 | 213 |
| 214 content::WebContents* target_contents = | 214 content::WebContents* target_contents = |
| 215 target_browser->tab_strip_model()->GetActiveWebContents(); | 215 target_browser->tab_strip_model()->GetActiveWebContents(); |
| 216 if (!target_contents) { | 216 if (!target_contents) { |
| 217 error_ = kFindingTabError; | 217 error_ = kFindingTabError; |
| 218 return false; | 218 return false; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 // No maximum size was provided, so just return the default size bounded by | 386 // No maximum size was provided, so just return the default size bounded by |
| 387 // the minimum size. | 387 // the minimum size. |
| 388 return gfx::Size(std::max(kDefaultWidth, min_size.width()), | 388 return gfx::Size(std::max(kDefaultWidth, min_size.width()), |
| 389 std::max(kDefaultHeight, min_size.height())); | 389 std::max(kDefaultHeight, min_size.height())); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace extensions | 392 } // namespace extensions |
| OLD | NEW |