Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 203042: windows.create({url:}) now supports relative paths. tabs.update()/tabs.move() now return Tab. (Closed)
Patch Set: forgot page Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/common_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tabs_module.cc
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 01788ea6d7f8da219308af659c07e750cf02f741..bc4cbe1dfb7f38d21e088d561d387604620c40cc 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -260,9 +260,14 @@ bool CreateWindowFunction::RunImpl() {
&url_input));
url.reset(new GURL(url_input));
if (!url->is_valid()) {
- error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError,
- url_input);
- return false;
+ // The path as passed in is not valid. Try converting to absolute path.
+ *url = GetExtension()->GetResourceURL(url_input);
+ if (!url->is_valid()) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kInvalidUrlError,
+ url_input);
+ return false;
+ }
}
}
}
@@ -598,6 +603,10 @@ bool UpdateTabFunction::RunImpl() {
}
}
+ if (has_callback())
+ result_.reset(ExtensionTabUtil::CreateTabValue(contents, tab_strip,
+ tab_index));
+
return true;
}
@@ -616,9 +625,10 @@ bool MoveTabFunction::RunImpl() {
Browser* source_browser = NULL;
TabStripModel* source_tab_strip = NULL;
+ TabContents* contents = NULL;
int tab_index = -1;
- if (!GetTabById(tab_id, profile(), &source_browser, &source_tab_strip, NULL,
- &tab_index, &error_))
+ if (!GetTabById(tab_id, profile(), &source_browser, &source_tab_strip,
+ &contents, &tab_index, &error_))
return false;
if (update_props->HasKey(keys::kWindowIdKey)) {
@@ -635,7 +645,7 @@ bool MoveTabFunction::RunImpl() {
if (ExtensionTabUtil::GetWindowId(target_browser) !=
ExtensionTabUtil::GetWindowId(source_browser)) {
TabStripModel* target_tab_strip = target_browser->tabstrip_model();
- TabContents *contents = source_tab_strip->DetachTabContentsAt(tab_index);
+ contents = source_tab_strip->DetachTabContentsAt(tab_index);
if (!contents) {
error_ = ExtensionErrorUtils::FormatErrorMessage(
keys::kTabNotFoundError, IntToString(tab_id));
@@ -650,6 +660,10 @@ bool MoveTabFunction::RunImpl() {
target_tab_strip->InsertTabContentsAt(new_index, contents,
false, true);
+ if (has_callback())
+ result_.reset(ExtensionTabUtil::CreateTabValue(contents,
+ target_tab_strip, new_index));
+
return true;
}
}
@@ -662,7 +676,10 @@ bool MoveTabFunction::RunImpl() {
if (new_index != tab_index)
source_tab_strip->MoveTabContentsAt(tab_index, new_index, false);
-
+
+ if (has_callback())
+ result_.reset(ExtensionTabUtil::CreateTabValue(contents, source_tab_strip,
+ new_index));
return true;
}
« no previous file with comments | « no previous file | chrome/common/common_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698