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 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 namespace api { | 10 namespace api { |
11 | 11 |
12 BrowserOpenTabFunction::~BrowserOpenTabFunction() { | 12 BrowserOpenTabFunction::~BrowserOpenTabFunction() { |
13 } | 13 } |
14 | 14 |
15 bool BrowserOpenTabFunction::RunSync() { | 15 bool BrowserOpenTabFunction::RunSync() { |
16 scoped_ptr<browser::OpenTab::Params> params( | 16 std::unique_ptr<browser::OpenTab::Params> params( |
17 browser::OpenTab::Params::Create(*args_)); | 17 browser::OpenTab::Params::Create(*args_)); |
18 EXTENSION_FUNCTION_VALIDATE(params.get()); | 18 EXTENSION_FUNCTION_VALIDATE(params.get()); |
19 | 19 |
20 ExtensionTabUtil::OpenTabParams options; | 20 ExtensionTabUtil::OpenTabParams options; |
21 options.create_browser_if_needed = true; | 21 options.create_browser_if_needed = true; |
22 options.url.reset(new std::string(params->options.url)); | 22 options.url.reset(new std::string(params->options.url)); |
23 | 23 |
24 std::string error; | 24 std::string error; |
25 scoped_ptr<base::DictionaryValue> result( | 25 std::unique_ptr<base::DictionaryValue> result( |
26 ExtensionTabUtil::OpenTab(this, options, &error)); | 26 ExtensionTabUtil::OpenTab(this, options, &error)); |
27 if (!result) { | 27 if (!result) { |
28 SetError(error); | 28 SetError(error); |
29 return false; | 29 return false; |
30 } | 30 } |
31 | 31 |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 } // namespace api | 35 } // namespace api |
36 } // namespace extensions | 36 } // namespace extensions |
OLD | NEW |