summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_get_views_apitest.cc23
-rw-r--r--chrome/browser/extensions/extension_infobar_apitest.cc23
-rw-r--r--chrome/browser/extensions/extension_infobar_module.cc17
-rw-r--r--chrome/browser/extensions/extension_infobar_module_constants.cc2
4 files changed, 56 insertions, 9 deletions
diff --git a/chrome/browser/extensions/extension_get_views_apitest.cc b/chrome/browser/extensions/extension_get_views_apitest.cc
new file mode 100644
index 0000000..8f1ced3
--- /dev/null
+++ b/chrome/browser/extensions/extension_get_views_apitest.cc
@@ -0,0 +1,23 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/common/chrome_switches.h"
+
+#if defined(TOOLKIT_VIEWS)
+// Need to port ExtensionInfoBarDelegate::CreateInfoBar() to other platforms.
+// See http://crbug.com/39916 for details.
+#define MAYBE_GetViews GetViews
+#else
+#define MAYBE_GetViews DISABLED_GetViews
+#endif
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViews) {
+ // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+
+ ASSERT_TRUE(RunExtensionTest("get_views")) << message_;
+}
diff --git a/chrome/browser/extensions/extension_infobar_apitest.cc b/chrome/browser/extensions/extension_infobar_apitest.cc
new file mode 100644
index 0000000..776b3a2
--- /dev/null
+++ b/chrome/browser/extensions/extension_infobar_apitest.cc
@@ -0,0 +1,23 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/common/chrome_switches.h"
+
+#if defined(TOOLKIT_VIEWS)
+// Need to port ExtensionInfoBarDelegate::CreateInfoBar() to other platforms.
+// See http://crbug.com/39916 for details.
+#define MAYBE_Infobars Infobars
+#else
+#define MAYBE_Infobars DISABLED_Infobars
+#endif
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
+ // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+
+ ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
+}
diff --git a/chrome/browser/extensions/extension_infobar_module.cc b/chrome/browser/extensions/extension_infobar_module.cc
index 01eec16..73768fb 100644
--- a/chrome/browser/extensions/extension_infobar_module.cc
+++ b/chrome/browser/extensions/extension_infobar_module.cc
@@ -29,24 +29,25 @@ bool ShowInfoBarFunction::RunImpl() {
Extension* extension = dispatcher()->GetExtension();
GURL url = extension->GetResourceURL(extension->url(), html_path);
- Browser* browser = dispatcher()->GetCurrentBrowser(true);
- if (!browser) {
- error_ = keys::kNoCurrentWindowError;
- return false;
- }
-
+ Browser* browser = NULL;
TabContents* tab_contents = NULL;
if (args->HasKey(keys::kTabId)) {
int tab_id = -1;
EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kTabId, &tab_id));
EXTENSION_FUNCTION_VALIDATE(ExtensionTabUtil::GetTabById(
- tab_id, browser->profile(), true, // Allow infobar in incognito.
- NULL, NULL, &tab_contents, NULL));
+ tab_id, profile(), true, // Allow infobar in incognito.
+ &browser, NULL, &tab_contents, NULL));
} else {
+ browser = dispatcher()->GetCurrentBrowser(true);
tab_contents = browser->GetSelectedTabContents();
}
+ if (!browser) {
+ error_ = keys::kNoCurrentWindowError;
+ return false;
+ }
+
if (!tab_contents) {
error_ = keys::kTabNotFoundError;
return false;
diff --git a/chrome/browser/extensions/extension_infobar_module_constants.cc b/chrome/browser/extensions/extension_infobar_module_constants.cc
index d628c48..1b0eef9 100644
--- a/chrome/browser/extensions/extension_infobar_module_constants.cc
+++ b/chrome/browser/extensions/extension_infobar_module_constants.cc
@@ -6,7 +6,7 @@
namespace extension_infobar_module_constants {
-const wchar_t kHtmlPath[] = L"htmlPath";
+const wchar_t kHtmlPath[] = L"path";
const wchar_t kTabId[] = L"tabId";
const char kNoCurrentWindowError[] = "No current browser window was found";