| Index: chrome/browser/extensions/api/tabs/tabs_api.cc
|
| diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
|
| index f92c45e7582cc3378ea143ac8fbdcda65110683a..32da55c2e56917dedf7f7218c110824bd99e83f8 100644
|
| --- a/chrome/browser/extensions/api/tabs/tabs_api.cc
|
| +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
|
| @@ -64,7 +64,6 @@
|
| #include "content/public/browser/render_widget_host_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/url_constants.h"
|
| -#include "extensions/browser/api/capture_web_contents_function_impl.h"
|
| #include "extensions/browser/app_window/app_window.h"
|
| #include "extensions/browser/extension_function_dispatcher.h"
|
| #include "extensions/browser/extension_function_util.h"
|
| @@ -105,8 +104,6 @@ namespace tabs = api::tabs;
|
|
|
| using core_api::extension_types::InjectDetails;
|
|
|
| -template class CaptureWebContentsFunction<ChromeAsyncExtensionFunction>;
|
| -
|
| namespace {
|
|
|
| bool GetBrowserFromWindowID(ChromeUIThreadExtensionFunction* function,
|
| @@ -125,6 +122,23 @@ bool GetBrowserFromWindowID(ChromeUIThreadExtensionFunction* function,
|
| return true;
|
| }
|
|
|
| +bool GetBrowserFromWindowID(ExtensionFunction* function,
|
| + const ChromeExtensionFunctionDetails& details,
|
| + int window_id,
|
| + Browser** browser) {
|
| + std::string error;
|
| + Browser* result;
|
| + result = ExtensionTabUtil::GetBrowserFromWindowID(
|
| + function, details, window_id, &error);
|
| + if (!result) {
|
| + function->SetError(error);
|
| + return false;
|
| + }
|
| +
|
| + *browser = result;
|
| + return true;
|
| +}
|
| +
|
| // |error_message| can optionally be passed in and will be set with an
|
| // appropriate message if the tab cannot be found by id.
|
| bool GetTabById(int tab_id,
|
| @@ -1498,8 +1512,12 @@ bool TabsRemoveFunction::RemoveTab(int tab_id) {
|
| return true;
|
| }
|
|
|
| +TabsCaptureVisibleTabFunction::TabsCaptureVisibleTabFunction()
|
| + : chrome_details_(this) {
|
| +}
|
| +
|
| bool TabsCaptureVisibleTabFunction::IsScreenshotEnabled() {
|
| - PrefService* service = GetProfile()->GetPrefs();
|
| + PrefService* service = chrome_details_.GetProfile()->GetPrefs();
|
| if (service->GetBoolean(prefs::kDisableScreenshots)) {
|
| error_ = keys::kScreenshotsDisabled;
|
| return false;
|
| @@ -1509,7 +1527,7 @@ bool TabsCaptureVisibleTabFunction::IsScreenshotEnabled() {
|
|
|
| WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) {
|
| Browser* browser = NULL;
|
| - if (!GetBrowserFromWindowID(this, window_id, &browser))
|
| + if (!GetBrowserFromWindowID(this, chrome_details_, window_id, &browser))
|
| return NULL;
|
|
|
| WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
|
|
|