summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser.cc
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 04:16:26 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 04:16:26 +0000
commit0e71e415c2c0cfe69aa419cef78f5baee929aed9 (patch)
tree05398f0d49b742e416cb983ceb77fd133e78d3db /chrome/browser/ui/browser.cc
parent5b2cdfa30d13bf78f468d49ced34fd42bbc4bcd4 (diff)
downloadchromium_src-0e71e415c2c0cfe69aa419cef78f5baee929aed9.zip
chromium_src-0e71e415c2c0cfe69aa419cef78f5baee929aed9.tar.gz
chromium_src-0e71e415c2c0cfe69aa419cef78f5baee929aed9.tar.bz2
Don't update icon of chrome app shortcuts from the favicon of the hosted URL.
Panel apps should always launch in a panel. Get rid of the non-extension OpenApplicationWindow(). Add TODO to continue untangling. BUG=65632 TEST=Create a desktop shortcut for a hosted app. Quit chrome, open the shortcut. Icon should not change. Review URL: http://codereview.chromium.org/5560007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser.cc')
-rw-r--r--chrome/browser/ui/browser.cc47
1 files changed, 33 insertions, 14 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 6f1e1e9..a42483c 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -525,12 +525,18 @@ TabContents* Browser::OpenApplication(
switch (container) {
case extension_misc::LAUNCH_WINDOW:
- tab = Browser::OpenApplicationWindow(profile,
- extension->GetFullLaunchURL());
+ // TODO(skerner): Setting |extension| to NULL is odd.
+ // Not doing so triggers some vestigial extensions app window
+ // behavior that leads to crashes. This sort of window is no
+ // longer supported, and its remains need to be cleaned up.
+ // crbug/65630 tracks this cleanup.
+ tab = Browser::OpenApplicationWindow(profile, NULL, container,
+ extension->GetFullLaunchURL(),
+ NULL);
break;
case extension_misc::LAUNCH_PANEL:
tab = Browser::OpenApplicationWindow(profile, extension, container,
- GURL());
+ GURL(), NULL);
break;
case extension_misc::LAUNCH_TAB: {
tab = Browser::OpenApplicationTab(profile, extension, existing_tab);
@@ -548,7 +554,8 @@ TabContents* Browser::OpenApplicationWindow(
Profile* profile,
const Extension* extension,
extension_misc::LaunchContainer container,
- const GURL& url_input) {
+ const GURL& url_input,
+ Browser** app_browser) {
GURL url;
if (!url_input.is_empty()) {
if (extension)
@@ -566,6 +573,9 @@ TabContents* Browser::OpenApplicationWindow(
bool as_panel = extension && (container == extension_misc::LAUNCH_PANEL);
Browser* browser = Browser::CreateForApp(app_name, extension, profile,
as_panel);
+ if (app_browser)
+ *app_browser = browser;
+
TabContentsWrapper* wrapper =
browser->AddSelectedTabWithURL(url, PageTransition::START_PAGE);
TabContents* contents = wrapper->tab_contents();
@@ -576,24 +586,33 @@ TabContents* Browser::OpenApplicationWindow(
// TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
// focus explicitly.
contents->view()->SetInitialFocus();
+ return contents;
+}
+
+TabContents* Browser::OpenAppShortcutWindow(Profile* profile,
+ const GURL& url,
+ bool update_shortcut) {
+ Browser* app_browser;
+ TabContents* tab = OpenApplicationWindow(
+ profile,
+ NULL, // this is a URL app. No extension.
+ extension_misc::LAUNCH_WINDOW,
+ url,
+ &app_browser);
+
+ if (!tab)
+ return NULL;
- if (!as_panel) {
+ if (update_shortcut) {
// Set UPDATE_SHORTCUT as the pending web app action. This action is picked
// up in LoadingStateChanged to schedule a GetApplicationInfo. And when
// the web app info is available, TabContents notifies Browser via
// OnDidGetApplicationInfo, which calls
// web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
// pending web app action.
- browser->pending_web_app_action_ = UPDATE_SHORTCUT;
+ app_browser->pending_web_app_action_ = UPDATE_SHORTCUT;
}
-
- return contents;
-}
-
-// static
-TabContents* Browser::OpenApplicationWindow(Profile* profile, const GURL& url) {
- return OpenApplicationWindow(profile, NULL, extension_misc::LAUNCH_WINDOW,
- url);
+ return tab;
}
// static