summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc16
-rw-r--r--chrome/browser/defaults.cc2
-rw-r--r--chrome/browser/defaults.h3
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc2
-rw-r--r--chrome/browser/dom_ui/shown_sections_handler.cc5
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc9
-rw-r--r--chrome/browser/profile.cc2
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc7
-rw-r--r--chrome/common/chrome_switches.cc8
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/extensions/extension.cc14
-rw-r--r--chrome/common/extensions/extension.h4
-rw-r--r--chrome/test/in_process_browser_test.cc5
-rw-r--r--chrome/test/ui/ui_test.cc8
14 files changed, 31 insertions, 55 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index b723a85c..f86a9d0 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1050,17 +1050,13 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
}
bool Browser::OpenAppsPanelAsNewTab() {
-#if defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_WIN)
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kDisableAppsPanel) ||
- (!browser_defaults::kShowAppsPanelForNewTab &&
- !command_line->HasSwitch(switches::kAppsPanel))) {
- return false;
+ if (command_line->HasSwitch(switches::kAppsPanel)) {
+ AppLauncher::ShowForNewTab(this, std::string());
+ return true;
}
- AppLauncher::ShowForNewTab(this, std::string());
- return true;
-#endif // OS_CHROMEOS || OS_WIN
-
+#endif
return false;
}
@@ -2084,7 +2080,7 @@ void Browser::ExecuteCommand(int id) {
TabContents* Browser::AddBlankTab(bool foreground) {
// To make a more "launchy" experience, try to reuse an existing NTP if there
// is one.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) {
+ if (Extension::AppsAreEnabled()) {
for (int i = tabstrip_model_.count() - 1; i >= 0; --i) {
TabContents* contents = tabstrip_model_.GetTabContentsAt(i);
if (StartsWithASCII(contents->GetURL().spec(),
diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc
index ca50e70..a669305 100644
--- a/chrome/browser/defaults.cc
+++ b/chrome/browser/defaults.cc
@@ -25,7 +25,6 @@ const bool kDownloadPageHasShowInFolder = false;
const bool kSizeTabButtonToTopOfTabStrip = true;
const bool kBootstrapSyncAuthentication = true;
const bool kShowOtherBrowsersInAboutMemory = false;
-const bool kShowAppsPanelForNewTab = true;
#elif defined(TOOLKIT_USES_GTK)
@@ -66,7 +65,6 @@ const bool kOSSupportsOtherBrowsers = true;
const bool kSizeTabButtonToTopOfTabStrip = false;
const bool kBootstrapSyncAuthentication = false;
const bool kShowOtherBrowsersInAboutMemory = true;
-const bool kShowAppsPanelForNewTab = false;
#endif
#if defined(OS_MACOSX)
diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h
index 8a2b543..11dee1f 100644
--- a/chrome/browser/defaults.h
+++ b/chrome/browser/defaults.h
@@ -67,9 +67,6 @@ extern const bool kBootstrapSyncAuthentication;
// Should other browsers be shown in about:memory page?
extern const bool kShowOtherBrowsersInAboutMemory;
-// Should we show the app panel when a new tab is created?
-extern const bool kShowAppsPanelForNewTab;
-
} // namespace browser_defaults
#endif // CHROME_BROWSER_DEFAULTS_H_
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 693618e..5ae65a7 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -505,7 +505,7 @@ NewTabUI::NewTabUI(TabContents* contents)
if (ProfileSyncService::IsSyncEnabled()) {
AddMessageHandler((new NewTabPageSyncHandler())->Attach(this));
}
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) {
+ if (Extension::AppsAreEnabled()) {
ExtensionsService* service = GetProfile()->GetExtensionsService();
AddMessageHandler((new AppLauncherHandler(service))->Attach(this));
}
diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc
index 501c1d8..ecc8f1b 100644
--- a/chrome/browser/dom_ui/shown_sections_handler.cc
+++ b/chrome/browser/dom_ui/shown_sections_handler.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
namespace {
@@ -87,7 +88,7 @@ void ShownSectionsHandler::SetFirstAppLauncherRunPref(
// If we have turned on Apps we want to hide most visited and recent to give
// more focus to the Apps section. We do not do this in MigrateUserPrefs
// because the pref version should not depend on command line switches.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps) &&
+ if (Extension::AppsAreEnabled() &&
!pref_service->GetBoolean(prefs::kNTPAppLauncherFirstRun)) {
int sections = pref_service->GetInteger(prefs::kNTPShownSections);
sections &= ~THUMB;
@@ -101,7 +102,7 @@ void ShownSectionsHandler::SetFirstAppLauncherRunPref(
void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) {
pref_service->RegisterIntegerPref(prefs::kNTPShownSections,
THUMB | RECENT | TIPS | SYNC);
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) {
+ if (Extension::AppsAreEnabled()) {
pref_service->RegisterBooleanPref(prefs::kNTPAppLauncherFirstRun, false);
}
}
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index c85b254..552e231 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -273,13 +273,8 @@ void ExtensionInstallUI::OnImageLoaded(
switch (prompt_type_) {
case INSTALL_PROMPT: {
- if (extension_->GetFullLaunchURL().is_valid()) {
- // Special case extension apps to not show the install dialog.
- // TODO(finnur): http://crbug.com/42443: Don't do this for all apps.
- delegate_->InstallUIProceed(false); // |create_app_shortcut|.
- return;
- }
-
+ // TODO(jcivelli): http://crbug.com/44771 We should not show an install
+ // dialog when installing an app from the gallery.
NotificationService* service = NotificationService::current();
service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
Source<ExtensionInstallUI>(this),
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 505a528..eeeee11 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -766,7 +766,7 @@ void ProfileImpl::InitExtensions() {
// Some sample apps to make our lives easier while we are developing extension
// apps. This way we don't have to constantly install these over and over.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) {
+ if (Extension::AppsAreEnabled()) {
#if defined(OS_WIN)
std::string user_domain;
if (base::EnvVarGetter::Create()->GetEnv("USERDOMAIN", &user_domain) &&
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 8ff3c42..56f2f79 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -33,7 +33,6 @@
#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/location_bar/location_bar_view.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
@@ -461,10 +460,8 @@ void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) {
gfx::Size BookmarkBarView::GetPreferredSize() {
// We don't want the bookmark bar view in the app launcher new tab page.
- static bool extension_apps = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableApps);
- bool hide_bookmark_bar = (extension_apps && OnNewTabPage()) ||
- OnAppsPage();
+ bool hide_bookmark_bar =
+ (Extension::AppsAreEnabled() && OnNewTabPage()) || OnAppsPage();
if (!hide_bookmark_bar)
return LayoutItems(true);
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 64da0bd..fece52f 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -103,14 +103,6 @@ const char kDisableAltWinstation[] = "disable-winsta";
// Disable the ApplicationCache.
const char kDisableApplicationCache[] = "disable-application-cache";
-// Disables the app launcher popup when a new tab is created, directly creates
-// a tab instead. Takes precedence over kAppLauncherForNewTab.
-// TODO(jcivelli): http://crbug.com/44089 this flag is required for some tests
-// to work, as showing the app launcher is the default on
-// ChromeOS but not on other platforms. Tests should be fixed
-// once it becomes the default behavior on all platforms.
-const char kDisableAppsPanel[] = "disable-apps-panel";
-
// Replaces the audio IPC layer for <audio> and <video> with a mock audio
// device, useful when using remote desktop or machines without sound cards.
// This is temporary until we fix the underlying problem.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 26a94f9..71b6afb 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -45,7 +45,6 @@ extern const char kDebugPrint[];
extern const char kDiagnostics[];
extern const char kDisableAltWinstation[];
extern const char kDisableApplicationCache[];
-extern const char kDisableAppsPanel[];
extern const char kDisableAudio[];
extern const char kDisableAuthNegotiateCnameLookup[];
extern const char kDisableBackingStoreLimit[];
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 956017c..89d7095 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -724,8 +724,7 @@ Extension::Extension(const FilePath& path)
being_upgraded_(false) {
DCHECK(path.IsAbsolute());
- apps_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableApps);
+ apps_enabled_ = AppsAreEnabled();
location_ = INVALID;
#if defined(OS_WIN)
@@ -930,6 +929,17 @@ GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) {
chrome::kStandardSchemeSeparator + extension_id + "/");
}
+// static
+bool Extension::AppsAreEnabled() {
+#if defined(OS_CHROMEOS)
+ return true;
+#else
+ static bool apps_enabled_mode =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps);
+ return apps_enabled_mode;
+#endif
+}
+
bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
std::string* error) {
if (source.HasKey(keys::kPublicKey)) {
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 9063b12..a135df5 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -209,6 +209,10 @@ class Extension {
// Returns the base extension url for a given |extension_id|.
static GURL GetBaseURLFromExtensionId(const std::string& extension_id);
+ // Returns whether the browser has apps enabled (either as the default or if
+ // it was explictly turned on via a command line switch).
+ static bool AppsAreEnabled();
+
// Initialize the extension from a parsed manifest.
// Usually, the id of an extension is generated by the "key" property of
// its manifest, but if |require_key| is |false|, a temporary ID will be
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 8a71b9d..9939108 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -138,11 +138,6 @@ void InProcessBrowserTest::SetUp() {
// Don't show the first run ui.
command_line->AppendSwitch(switches::kNoFirstRun);
- // TODO(jcivelli): http://crbug.com/44089 We disable the app launcher on new
- // tab behavior for now until it is the default behavior on
- // all platforms.
- command_line->AppendSwitch(switches::kDisableAppsPanel);
-
// This is a Browser test.
command_line->AppendSwitchWithValue(switches::kTestType,
ASCIIToWide(kBrowserTestType));
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 6b8c2a5..7312b8c 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -130,10 +130,6 @@ UITestBase::UITestBase()
terminate_timeout_ms_(kWaitForTerminateMsec) {
PathService::Get(chrome::DIR_APP, &browser_directory_);
PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
- // TODO(jcivelli): http://crbug.com/44089 We disable the app launcher on new
- // tab behavior for now until it is the default behavior on
- // all platforms.
- launch_arguments_.AppendSwitch(switches::kDisableAppsPanel);
}
UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
@@ -160,10 +156,6 @@ UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
terminate_timeout_ms_(kWaitForTerminateMsec) {
PathService::Get(chrome::DIR_APP, &browser_directory_);
PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
- // TODO(jcivelli): http://crbug.com/44089 We disable the app launcher on new
- // tab behavior for now until it is the default behavior on
- // all platforms.
- launch_arguments_.AppendSwitch(switches::kDisableAppsPanel);
}
UITestBase::~UITestBase() {