Index: chrome/browser/extensions/api/tabs/tabs.cc |
diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc |
index 3d80a52e7ef640dd813a48194a717a80f717f276..065b5281305afa0e36c654b6be839f2870a49bfd 100644 |
--- a/chrome/browser/extensions/api/tabs/tabs.cc |
+++ b/chrome/browser/extensions/api/tabs/tabs.cc |
@@ -261,9 +261,9 @@ bool GetWindowFunction::RunImpl() { |
return false; |
if (populate_tabs) |
- result_.reset(controller->CreateWindowValueWithTabs()); |
+ SetSingleResult(controller->CreateWindowValueWithTabs()); |
else |
- result_.reset(controller->CreateWindowValue()); |
+ SetSingleResult(controller->CreateWindowValue()); |
return true; |
} |
@@ -282,9 +282,9 @@ bool GetCurrentWindowFunction::RunImpl() { |
return false; |
} |
if (populate_tabs) |
- result_.reset(controller->CreateWindowValueWithTabs()); |
+ SetSingleResult(controller->CreateWindowValueWithTabs()); |
else |
- result_.reset(controller->CreateWindowValue()); |
+ SetSingleResult(controller->CreateWindowValue()); |
return true; |
} |
@@ -309,9 +309,9 @@ bool GetLastFocusedWindowFunction::RunImpl() { |
ExtensionWindowController* controller = |
browser->extension_window_controller(); |
if (populate_tabs) |
- result_.reset(controller->CreateWindowValueWithTabs()); |
+ SetSingleResult(controller->CreateWindowValueWithTabs()); |
else |
- result_.reset(controller->CreateWindowValue()); |
+ SetSingleResult(controller->CreateWindowValue()); |
return true; |
} |
@@ -336,7 +336,7 @@ bool GetAllWindowsFunction::RunImpl() { |
else |
window_list->Append((*iter)->CreateWindowValue()); |
} |
- result_.reset(window_list); |
+ SetSingleResult(window_list); |
return true; |
} |
@@ -583,8 +583,8 @@ bool CreateWindowFunction::RunImpl() { |
// Note: Panels ignore all but the first url provided. |
PanelViewAura* panel_view = new PanelViewAura(title); |
panel_view->Init(window_profile, urls[0], panel_bounds); |
- result_.reset(panel_view->extension_window_controller()-> |
- CreateWindowValueWithTabs()); |
+ SetSingleResult(panel_view->extension_window_controller()-> |
+ CreateWindowValueWithTabs()); |
return true; |
} |
#else |
@@ -600,7 +600,7 @@ bool CreateWindowFunction::RunImpl() { |
else |
panel->Show(); |
- result_.reset( |
+ SetSingleResult( |
panel->extension_window_controller()->CreateWindowValueWithTabs()); |
return true; |
} |
@@ -651,9 +651,9 @@ bool CreateWindowFunction::RunImpl() { |
if (new_window->profile()->IsOffTheRecord() && !include_incognito()) { |
// Don't expose incognito windows if the extension isn't allowed. |
- result_.reset(Value::CreateNullValue()); |
+ SetSingleResult(Value::CreateNullValue()); |
} else { |
- result_.reset( |
+ SetSingleResult( |
new_window->extension_window_controller()->CreateWindowValueWithTabs()); |
} |
@@ -791,7 +791,7 @@ bool UpdateWindowFunction::RunImpl() { |
controller->window()->FlashFrame(draw_attention); |
} |
- result_.reset(controller->CreateWindowValue()); |
+ SetSingleResult(controller->CreateWindowValue()); |
return true; |
} |
@@ -833,7 +833,7 @@ bool GetSelectedTabFunction::RunImpl() { |
error_ = keys::kNoSelectedTabError; |
return false; |
} |
- result_.reset(ExtensionTabUtil::CreateTabValue(contents->web_contents(), |
+ SetSingleResult(ExtensionTabUtil::CreateTabValue(contents->web_contents(), |
tab_strip, |
tab_strip->active_index())); |
return true; |
@@ -849,7 +849,7 @@ bool GetAllTabsInWindowFunction::RunImpl() { |
if (!GetBrowserFromWindowID(this, window_id, &browser)) |
return false; |
- result_.reset(ExtensionTabUtil::CreateTabList(browser)); |
+ SetSingleResult(ExtensionTabUtil::CreateTabList(browser)); |
return true; |
} |
@@ -964,7 +964,7 @@ bool QueryTabsFunction::RunImpl() { |
} |
} |
- result_.reset(result); |
+ SetSingleResult(result); |
return true; |
} |
@@ -1095,7 +1095,7 @@ bool CreateTabFunction::RunImpl() { |
// Return data about the newly created tab. |
if (has_callback()) { |
- result_.reset(ExtensionTabUtil::CreateTabValue( |
+ SetSingleResult(ExtensionTabUtil::CreateTabValue( |
params.target_contents->web_contents(), |
tab_strip, new_index)); |
} |
@@ -1114,7 +1114,7 @@ bool GetTabFunction::RunImpl() { |
NULL, &tab_strip, &contents, &tab_index, &error_)) |
return false; |
- result_.reset(ExtensionTabUtil::CreateTabValue(contents->web_contents(), |
+ SetSingleResult(ExtensionTabUtil::CreateTabValue(contents->web_contents(), |
tab_strip, |
tab_index)); |
return true; |
@@ -1125,7 +1125,7 @@ bool GetCurrentTabFunction::RunImpl() { |
WebContents* contents = dispatcher()->delegate()->GetAssociatedWebContents(); |
if (contents) |
- result_.reset(ExtensionTabUtil::CreateTabValue(contents)); |
+ SetSingleResult(ExtensionTabUtil::CreateTabValue(contents)); |
return true; |
} |
@@ -1181,7 +1181,7 @@ bool HighlightTabsFunction::RunImpl() { |
selection.set_active(active_index); |
browser->tab_strip_model()->SetSelectionFromModel(selection); |
- result_.reset( |
+ SetSingleResult( |
browser->extension_window_controller()->CreateWindowValueWithTabs()); |
return true; |
} |
@@ -1355,10 +1355,10 @@ void UpdateTabFunction::PopulateResult() { |
return; |
if (GetExtension()->HasAPIPermission(extensions::APIPermission::kTab)) { |
- result_.reset( |
+ SetSingleResult( |
ExtensionTabUtil::CreateTabValue(tab_contents_->web_contents())); |
} else { |
- result_.reset(Value::CreateNullValue()); |
+ SetSingleResult(Value::CreateNullValue()); |
} |
} |
@@ -1481,11 +1481,11 @@ bool MoveTabsFunction::RunImpl() { |
// Only return the results as an array if there are multiple tabs. |
if (tab_ids.size() > 1) { |
- result_.reset(tab_values.DeepCopy()); |
+ SetSingleResult(tab_values.DeepCopy()); |
} else if (tab_ids.size() == 1) { |
Value* value = NULL; |
CHECK(tab_values.Get(0, &value)); |
- result_.reset(value->DeepCopy()); |
+ SetSingleResult(value->DeepCopy()); |
} |
return true; |
} |
@@ -1752,7 +1752,7 @@ void CaptureVisibleTabFunction::SendResultFromBitmap( |
base::Base64Encode(stream_as_string, &base64_result); |
base64_result.insert(0, base::StringPrintf("data:%s;base64,", |
mime_type.c_str())); |
- result_.reset(new StringValue(base64_result)); |
+ SetSingleResult(new StringValue(base64_result)); |
SendResponse(true); |
} |
@@ -1828,7 +1828,7 @@ void DetectTabLanguageFunction::Observe( |
} |
void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
- result_.reset(Value::CreateStringValue(language.c_str())); |
+ SetSingleResult(Value::CreateStringValue(language.c_str())); |
SendResponse(true); |
Release(); // Balanced in Run() |