diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-05 17:15:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-11 07:47:18 +0000 |
commit | 7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch) | |
tree | a3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/chrome/browser/extensions/api/tabs/tabs_api.cc | |
parent | 6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff) | |
download | qtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz |
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/chrome/browser/extensions/api/tabs/tabs_api.cc')
-rw-r--r-- | chromium/chrome/browser/extensions/api/tabs/tabs_api.cc | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc index a92dd4acf19..c36bc009006 100644 --- a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -589,13 +589,15 @@ ExtensionFunction::ResponseAction WindowsCreateFunction::Run() { #endif // defined(USE_ASH) // Create a new BrowserWindow. - Browser::CreateParams create_params(window_type, window_profile); + Browser::CreateParams create_params(window_type, window_profile, + user_gesture()); if (extension_id.empty()) { create_params.initial_bounds = window_bounds; } else { create_params = Browser::CreateParams::CreateForApp( web_app::GenerateApplicationNameFromExtensionId(extension_id), - false /* trusted_source */, window_bounds, window_profile); + false /* trusted_source */, window_bounds, window_profile, + user_gesture()); } create_params.initial_show_state = ui::SHOW_STATE_NORMAL; if (create_data && create_data->state) { @@ -1004,7 +1006,7 @@ ExtensionFunction::ResponseAction TabsCreateFunction::Run() { std::string error; std::unique_ptr<base::DictionaryValue> result( - ExtensionTabUtil::OpenTab(this, options, &error)); + ExtensionTabUtil::OpenTab(this, options, user_gesture(), &error)); if (!result) return RespondNow(Error(error)); @@ -1666,7 +1668,7 @@ bool TabsCaptureVisibleTabFunction::RunAsync() { return CaptureAsync( contents, image_details.get(), - base::Bind(&TabsCaptureVisibleTabFunction::CopyFromBackingStoreComplete, + base::Bind(&TabsCaptureVisibleTabFunction::CopyFromSurfaceComplete, this)); } @@ -1800,7 +1802,10 @@ ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} bool ExecuteCodeInTabFunction::HasPermission() { - if (Init() && + if (Init() == SUCCESS && + // TODO(devlin/lazyboy): Consider removing the following check as it isn't + // doing anything. The fallback to ExtensionFunction::HasPermission() + // below dictates what this function returns. extension_->permissions_data()->HasAPIPermissionForTab( execute_tab_id_, APIPermission::kTab)) { return true; @@ -1808,38 +1813,40 @@ bool ExecuteCodeInTabFunction::HasPermission() { return ExtensionFunction::HasPermission(); } -bool ExecuteCodeInTabFunction::Init() { - if (details_.get()) - return true; +ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { + if (init_result_) + return init_result_.value(); // |tab_id| is optional so it's ok if it's not there. int tab_id = -1; - if (args_->GetInteger(0, &tab_id)) - EXTENSION_FUNCTION_VALIDATE(tab_id >= 0); + if (args_->GetInteger(0, &tab_id) && tab_id < 0) + return set_init_result(VALIDATION_FAILURE); // |details| are not optional. base::DictionaryValue* details_value = NULL; if (!args_->GetDictionary(1, &details_value)) - return false; + return set_init_result(VALIDATION_FAILURE); std::unique_ptr<InjectDetails> details(new InjectDetails()); if (!InjectDetails::Populate(*details_value, details.get())) - return false; + return set_init_result(VALIDATION_FAILURE); // If the tab ID wasn't given then it needs to be converted to the // currently active tab's ID. if (tab_id == -1) { Browser* browser = chrome_details_.GetCurrentBrowser(); + // Can happen during shutdown. if (!browser) - return false; + return set_init_result_error(keys::kNoCurrentWindowError); content::WebContents* web_contents = NULL; + // Can happen during shutdown. if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) - return false; + return set_init_result_error(keys::kNoTabInBrowserWindowError); } execute_tab_id_ = tab_id; details_ = std::move(details); set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); - return true; + return set_init_result(SUCCESS); } bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |