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

Unified Diff: chrome/browser/browser.cc

Issue 18093: Changes to insure that when in app-mode, links open in the default browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | « chrome/browser/browser.h ('k') | chrome/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 8370)
+++ chrome/browser/browser.cc (working copy)
@@ -163,7 +163,8 @@
is_attempting_to_close_browser_(false),
override_maximized_(false),
method_factory_(this),
- idle_task_(new BrowserIdleTimer) {
+ idle_task_(new BrowserIdleTimer),
+ open_new_windows_in_default_browser_(false) {
tabstrip_model_.AddObserver(this);
NotificationService::current()->AddObserver(
@@ -1109,7 +1110,7 @@
case IDC_NEW_WINDOW_PROFILE_5:
case IDC_NEW_WINDOW_PROFILE_6:
case IDC_NEW_WINDOW_PROFILE_7:
- case IDC_NEW_WINDOW_PROFILE_8:
+ case IDC_NEW_WINDOW_PROFILE_8:
NewProfileWindowByIndex(id - IDC_NEW_WINDOW_PROFILE_0); break;
case IDC_CLOSE_WINDOW: CloseWindow(); break;
case IDC_NEW_TAB: NewTab(); break;
@@ -1649,12 +1650,14 @@
DCHECK(disposition != SAVE_TO_DISK); // No code for this yet
// If this is an application we can only have one tab so we need to process
- // this in tabbed browser window.
- if (tabstrip_model_.count() > 0 &&
+ // this in tabbed browser window. The new window will act as an intermediary
+ // to launch urls in the default browser.
+ if (tabstrip_model_.count() > 0 && // A launched application has count of 1.
disposition != NEW_WINDOW && disposition != NEW_POPUP &&
type_ != TYPE_NORMAL) {
Browser* b = GetOrCreateTabbedBrowser();
DCHECK(b);
+ b->set_open_new_windows_in_default_browser(true);
Mark Larson 2009/01/23 07:02:33 When does this get unset?
PageTransition::Type transition = PageTransition::LINK;
// If we were called from an "installed webapp" we want to emulate the code
// that is run from browser_init.cc for links from external applications.
@@ -1664,7 +1667,13 @@
if (type_ == TYPE_APP)
transition = PageTransition::START_PAGE;
b->tabstrip_model()->AddTabContents(new_contents, -1, transition, true);
- b->window()->Show();
+
+ // All new windows from an "installed webapp" which must have their own
+ // tabs will be launched in the default browser. At this moment the
+ // url is inaccessbile and so we do not show the window until the url is
+ // reported to the TabConentsDelegate.
+ if (type_ != TYPE_APP)
+ b->window()->Show();
return;
}
@@ -1774,6 +1783,10 @@
return type_ == TYPE_APP;
}
+bool Browser::ShouldOpenURLInDefaultBrowser() const {
+ return open_new_windows_in_default_browser_;
+}
+
void Browser::ConvertContentsToApplication(TabContents* contents) {
WebContents* web_contents = contents->AsWebContents();
if (!web_contents || !web_contents->web_app()) {
@@ -2420,3 +2433,4 @@
}
#endif // OS_WIN
+
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698