OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/browser_api.h" | 5 #include "chrome/browser/extensions/api/browser/browser_api.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_tab_util.h" | 7 #include "chrome/browser/extensions/extension_tab_util.h" |
8 #include "chrome/common/extensions/api/browser.h" | 8 #include "chrome/common/extensions/api/browser.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 namespace api { | 11 namespace api { |
12 | 12 |
13 BrowserOpenTabFunction::~BrowserOpenTabFunction() { | 13 BrowserOpenTabFunction::~BrowserOpenTabFunction() { |
14 } | 14 } |
15 | 15 |
16 ExtensionFunction::ResponseAction BrowserOpenTabFunction::Run() { | 16 ExtensionFunction::ResponseAction BrowserOpenTabFunction::Run() { |
17 std::unique_ptr<browser::OpenTab::Params> params( | 17 std::unique_ptr<browser::OpenTab::Params> params( |
18 browser::OpenTab::Params::Create(*args_)); | 18 browser::OpenTab::Params::Create(*args_)); |
19 EXTENSION_FUNCTION_VALIDATE(params.get()); | 19 EXTENSION_FUNCTION_VALIDATE(params.get()); |
20 | 20 |
21 ExtensionTabUtil::OpenTabParams options; | 21 ExtensionTabUtil::OpenTabParams options; |
22 options.create_browser_if_needed = true; | 22 options.create_browser_if_needed = true; |
23 options.url.reset(new std::string(params->options.url)); | 23 options.url.reset(new std::string(params->options.url)); |
24 | 24 |
25 std::string error; | 25 std::string error; |
26 std::unique_ptr<base::DictionaryValue> result( | 26 std::unique_ptr<base::DictionaryValue> result( |
27 ExtensionTabUtil::OpenTab(this, options, &error)); | 27 ExtensionTabUtil::OpenTab(this, options, user_gesture(), &error)); |
28 if (!result) | 28 if (!result) |
29 return RespondNow(Error(error)); | 29 return RespondNow(Error(error)); |
30 | 30 |
31 return RespondNow(NoArguments()); | 31 return RespondNow(NoArguments()); |
32 } | 32 } |
33 | 33 |
34 } // namespace api | 34 } // namespace api |
35 } // namespace extensions | 35 } // namespace extensions |
OLD | NEW |