summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 23:53:57 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 23:53:57 +0000
commit4739354ca60bbb00ecbf0824c87fa11f45757402 (patch)
tree0a3621c63714b68b3759ad0d631daa9e2d71d0f8 /chrome/browser/extensions
parent0303c1151c1baad55157bde512fc622bc863cb1b (diff)
downloadchromium_src-4739354ca60bbb00ecbf0824c87fa11f45757402.zip
chromium_src-4739354ca60bbb00ecbf0824c87fa11f45757402.tar.gz
chromium_src-4739354ca60bbb00ecbf0824c87fa11f45757402.tar.bz2
Extension apis: windows.create({url:}) now supports relative paths.
tabs.update() & tabs.move() now return full Tab object. BUG=17665 Review URL: http://codereview.chromium.org/203042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 01788ea..bc4cbe1 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;
}