summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:17:41 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:17:41 +0000
commitdfa7406f877705d423d0fb63a9ea1a0001f0fbae (patch)
tree5d99f277151b8964a14df634993eeb89a41cb6d1 /chrome
parent529afc4a06f74fe8d93cb7d62ecfd23b338de78d (diff)
downloadchromium_src-dfa7406f877705d423d0fb63a9ea1a0001f0fbae.zip
chromium_src-dfa7406f877705d423d0fb63a9ea1a0001f0fbae.tar.gz
chromium_src-dfa7406f877705d423d0fb63a9ea1a0001f0fbae.tar.bz2
AppLauncher cleanup.
Pass browser to ctor as AppLauncher is created per browser instance. BUG=chromium-os:1795 TEST=none Review URL: http://codereview.chromium.org/1085006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/app_launcher.cc27
-rw-r--r--chrome/browser/chromeos/app_launcher.h8
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc4
3 files changed, 18 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/app_launcher.cc b/chrome/browser/chromeos/app_launcher.cc
index ea95e7a..d3e3fef 100644
--- a/chrome/browser/chromeos/app_launcher.cc
+++ b/chrome/browser/chromeos/app_launcher.cc
@@ -288,8 +288,8 @@ void AppLauncher::BubbleContainer::Layout() {
////////////////////////////////////////////////////////////////////////////////
// AppLauncher
-AppLauncher::AppLauncher()
- : browser_(NULL),
+AppLauncher::AppLauncher(Browser* browser)
+ : browser_(browser),
popup_(NULL),
site_instance_(NULL),
contents_rvh_(NULL),
@@ -343,6 +343,13 @@ AppLauncher::AppLauncher()
render_view_container_->Attach(rwhv_->GetNativeView());
contents_rvh_->NavigateToURL(menu_url);
+ navigation_bar_->Update(browser);
+ // Set the transient window so that ChromeOS WM treat this
+ // as if a popup window.
+ gtk_window_set_transient_for(
+ GTK_WINDOW(popup_->GetNativeView()),
+ GTK_WINDOW(browser_->window()->GetNativeHandle()));
+
ActiveWindowWatcherX::AddObserver(this);
}
@@ -352,25 +359,15 @@ AppLauncher::~AppLauncher() {
ActiveWindowWatcherX::RemoveObserver(this);
}
-void AppLauncher::Update(Browser* browser) {
- if (browser_ != browser) {
- browser_ = browser;
- navigation_bar_->Update(browser);
- // Set the transient window so that ChromeOS WM treat this
- // as if a popup window.
- gtk_window_set_transient_for(
- GTK_WINDOW(popup_->GetNativeView()),
- GTK_WINDOW(browser_->window()->GetNativeHandle()));
- }
-
+void AppLauncher::Update() {
popup_->SetBounds(browser_->window()->GetRestoredBounds());
top_container_->Layout();
}
-void AppLauncher::Show(Browser* browser) {
+void AppLauncher::Show() {
Cleanup();
- Update(browser);
+ Update();
popup_->Show();
GtkWidget* rwhv_widget = rwhv_->GetNativeView();
diff --git a/chrome/browser/chromeos/app_launcher.h b/chrome/browser/chromeos/app_launcher.h
index f6497d8..f2a8145 100644
--- a/chrome/browser/chromeos/app_launcher.h
+++ b/chrome/browser/chromeos/app_launcher.h
@@ -62,11 +62,11 @@ class AppLauncher : public RenderViewHostDelegate,
public ActiveWindowWatcherX::Observer,
public views::AcceleratorTarget {
public:
- AppLauncher();
+ AppLauncher(Browser* browser);
~AppLauncher();
// Shows the menu.
- void Show(Browser* browser);
+ void Show();
private:
// TabContentsDelegate and RenderViewHostDelegate::View have some methods
@@ -143,8 +143,8 @@ class AppLauncher : public RenderViewHostDelegate,
// hidden.
void Cleanup();
- // Updates the app launcher's state and layout with the |browser|.
- void Update(Browser* browser);
+ // Updates the app launcher's state.
+ void Update();
// RenderViewHostDelegate overrides.
virtual int GetBrowserWindowID() const {
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index f3d5db12..f5cd791 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -459,9 +459,9 @@ void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {
void BrowserView::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (!main_menu_.get()) {
- main_menu_.reset(new AppLauncher());
+ main_menu_.reset(new AppLauncher(browser()));
}
- main_menu_->Show(browser());
+ main_menu_->Show();
}
// views::ContextMenuController overrides.