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

Unified Diff: chrome/browser/browser.cc

Issue 3453029: Add user customizable launch type for apps. (Closed)
Patch Set: No images this time. Created 10 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/browser/chromeos/cros_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 1d2c82f1f5621d01736f7be9ad290cc47d9adbed..13bfbc1a238e036c5ca0d8707bbc433e1ca63086 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/extensions/extension_browser_event_router.h"
#include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_tabs_module.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/find_bar.h"
@@ -556,16 +557,28 @@ TabContents* Browser::OpenApplicationTab(Profile* profile,
Extension* extension,
Browser** browser) {
Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile);
+ TabContents* tab_contents = NULL;
if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL)
- return NULL;
+ return tab_contents;
+
+ // Check the prefs for overridden mode.
+ ExtensionsService* extensions_service = profile->GetExtensionsService();
+ DCHECK(extensions_service);
- // TODO(erikkay): This doesn't seem like the right transition in all cases.
- PageTransition::Type transition = PageTransition::START_PAGE;
+ ExtensionPrefs::LaunchType launch_type =
+ extensions_service->extension_prefs()->GetLaunchType(extension->id());
+ int add_type = TabStripModel::ADD_SELECTED;
+ if (launch_type == ExtensionPrefs::LAUNCH_PINNED)
+ add_type |= TabStripModel::ADD_PINNED;
- return local_browser->AddTabWithURL(
- extension->GetFullLaunchURL(), GURL(), transition, -1,
- TabStripModel::ADD_PINNED | TabStripModel::ADD_SELECTED,
- NULL, "", browser);
+ // TODO(erikkay): START_PAGE doesn't seem like the right transition in all
+ // cases.
+ tab_contents = local_browser->AddTabWithURL(extension->GetFullLaunchURL(),
+ GURL(), PageTransition::START_PAGE, -1, add_type, NULL, "", browser);
+ if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN)
+ local_browser->window()->SetFullscreen(true);
+
+ return tab_contents;
}
// static
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698