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 "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (!FeatureSwitch::tab_capture()->IsEnabled()) { | 47 if (!FeatureSwitch::tab_capture()->IsEnabled()) { |
48 error_ = kPermissionError; | 48 error_ = kPermissionError; |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 scoped_ptr<api::tab_capture::Capture::Params> params = | 52 scoped_ptr<api::tab_capture::Capture::Params> params = |
53 TabCapture::Capture::Params::Create(*args_); | 53 TabCapture::Capture::Params::Create(*args_); |
54 EXTENSION_FUNCTION_VALIDATE(params.get()); | 54 EXTENSION_FUNCTION_VALIDATE(params.get()); |
55 | 55 |
56 // Figure out the active WebContents and retrieve the needed ids. | 56 // Figure out the active WebContents and retrieve the needed ids. |
57 Browser* target_browser = browser::FindAnyBrowser(profile(), | 57 Browser* target_browser = chrome::FindAnyBrowser(profile(), |
58 include_incognito(), | 58 include_incognito(), |
59 chrome::GetActiveDesktop()); | 59 chrome::GetActiveDesktop()); |
60 if (!target_browser) { | 60 if (!target_browser) { |
61 error_ = kFindingTabError; | 61 error_ = kFindingTabError; |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 content::WebContents* target_contents = | 65 content::WebContents* target_contents = |
66 target_browser->tab_strip_model()->GetActiveWebContents(); | 66 target_browser->tab_strip_model()->GetActiveWebContents(); |
67 if (!target_contents) { | 67 if (!target_contents) { |
68 error_ = kFindingTabError; | 68 error_ = kFindingTabError; |
69 return false; | 69 return false; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 info->tab_id = it->tab_id; | 151 info->tab_id = it->tab_id; |
152 info->status = it->status; | 152 info->status = it->status; |
153 list->Append(info->ToValue().release()); | 153 list->Append(info->ToValue().release()); |
154 } | 154 } |
155 | 155 |
156 SetResult(list); | 156 SetResult(list); |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |