summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 18:16:32 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 18:16:32 +0000
commit3b523d16aba55258411512ea63b2e95ea747717f (patch)
treef40a650999b39f4db7aa2ca148db0aa14a6fbfea /chrome/browser/views
parent363250995f7ea9aaf2b47839ccd76448b54ffdb7 (diff)
downloadchromium_src-3b523d16aba55258411512ea63b2e95ea747717f.zip
chromium_src-3b523d16aba55258411512ea63b2e95ea747717f.tar.gz
chromium_src-3b523d16aba55258411512ea63b2e95ea747717f.tar.bz2
Fixes bug in app launcher. If the url is specified for the launcher
and the page tried to open a popup it would get eaten. BUG=Chrome OS bug 2770 TEST=see bug Review URL: http://codereview.chromium.org/1695012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/app_launcher.cc22
-rw-r--r--chrome/browser/views/app_launcher.h15
2 files changed, 20 insertions, 17 deletions
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index d1e87aa..b5fc226 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -52,6 +52,8 @@ const int kNavigationBarHeight = 25;
const int kAutocompleteEditFontDelta = 3;
// Command line switch for specifying url of the page.
+// TODO: nuke when we convert to the real app page. Also nuke code in
+// AddNewContents
const wchar_t kURLSwitch[] = L"main-menu-url";
// Returns the URL of the menu.
@@ -343,11 +345,25 @@ void AppLauncher::OpenURLFromTab(TabContents* source,
Hide();
}
+void AppLauncher::AddNewContents(TabContents* source,
+ TabContents* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture) {
+#if defined(OS_CHROMEOS)
+ // ChromeOS uses the kURLSwitch to specify a page that opens popups. We need
+ // to do this so the popups are opened when the user clicks on the page.
+ // TODO: nuke when convert to the real app page.
+ new_contents->set_delegate(NULL);
+ browser_->GetSelectedTabContents()->AddNewContents(
+ new_contents, disposition, initial_pos, user_gesture);
+ Hide();
+#endif
+}
+
void AppLauncher::InfoBubbleClosing(InfoBubble* info_bubble,
bool closed_by_escape) {
- // The stack may have pending_contents_ on it. Delay deleting the
- // pending_contents_ as TabContents doesn't deal well with being deleted
- // while on the stack.
+ // Delay deleting to be safe (we, and our tabcontents may be on the stack).
MessageLoop::current()->PostTask(FROM_HERE,
new DeleteTask<AppLauncher>(this));
}
diff --git a/chrome/browser/views/app_launcher.h b/chrome/browser/views/app_launcher.h
index 229f265..bd18cfb 100644
--- a/chrome/browser/views/app_launcher.h
+++ b/chrome/browser/views/app_launcher.h
@@ -36,16 +36,6 @@ class TabContentsDelegateImpl;
//
// To show the app launcher invoke Show.
//
-// AppLauncher creates a RenderViewHost and corresponding RenderWidgetHostView
-// to display the html page. AppLauncher acts as the RenderViewHostDelegate for
-// the RenderViewHost. Clicking on a link results in creating a new
-// TabContents (assigned to pending_contents_). One of two things can then
-// happen:
-// . If the page is a popup (ShowCreatedWindow passed NEW_POPUP), the
-// TabContents is added to the Browser.
-// . If the page requests a URL to be open (OpenURLFromTab), OpenURL is
-// invoked on the browser.
-//
// When a new url is opened, or the user clicks outsides the bounds of the
// widget the app launcher is closed.
class AppLauncher : public InfoBubbleDelegate,
@@ -84,7 +74,7 @@ class AppLauncher : public InfoBubbleDelegate,
TabContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
- bool user_gesture) {}
+ bool user_gesture);
virtual void ActivateContents(TabContents* contents) {}
virtual void LoadingStateChanged(TabContents* source) {}
virtual void CloseContents(TabContents* source) {}
@@ -113,9 +103,6 @@ class AppLauncher : public InfoBubbleDelegate,
// The view with the navigation bar and render view, shown in the info-bubble.
InfoBubbleContentsView* info_bubble_content_;
- // TabContents created when the user clicks a link.
- scoped_ptr<TabContents> pending_contents_;
-
DISALLOW_COPY_AND_ASSIGN(AppLauncher);
};