summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 21:45:43 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 21:45:43 +0000
commitf4481633ac082f136453be1926c77d0c079b10c4 (patch)
treec5eacd0695e35a513c8e5b0b3d291b4463117797 /chrome/browser/views
parent6f3ad64a8dae4529cd88358f6d91d8750b836367 (diff)
downloadchromium_src-f4481633ac082f136453be1926c77d0c079b10c4.zip
chromium_src-f4481633ac082f136453be1926c77d0c079b10c4.tar.gz
chromium_src-f4481633ac082f136453be1926c77d0c079b10c4.tar.bz2
Some layout related fixes for the app launchers.
BUG=None TEST=Check that the app launcher is displayed correctly on ChromeOS and Windows (when using the --app-launcher-new-tab) Review URL: http://codereview.chromium.org/1171002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/app_launcher.cc31
-rw-r--r--chrome/browser/views/app_launcher.h8
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc3
3 files changed, 27 insertions, 15 deletions
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index d787f16..f9c99a8 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -343,13 +343,14 @@ void InfoBubbleContentsView::ViewHierarchyChanged(
gfx::Size InfoBubbleContentsView::GetPreferredSize() {
gfx::Rect bounds = app_launcher_->browser()->window()->GetRestoredBounds();
- return gfx::Size(bounds.width() * 2 / 3, bounds.width() * 4 / 5);
+ return gfx::Size(bounds.width() * 2 / 3, bounds.height() * 4 / 5);
}
void InfoBubbleContentsView::Layout() {
if (bounds().IsEmpty() || GetChildViewCount() == 0)
return;
+ gfx::Rect bounds = GetLocalBounds(false);
int navigation_bar_height =
kNavigationBarHeight + kNavigationEntryYMargin * 2;
const views::Border* border = navigation_bar_->border();
@@ -358,11 +359,12 @@ void InfoBubbleContentsView::Layout() {
border->GetInsets(&insets);
navigation_bar_height += insets.height();
}
- navigation_bar_->SetBounds(x(), y(), width(), navigation_bar_height);
+ navigation_bar_->SetBounds(bounds.x(), bounds.y(),
+ bounds.width(), navigation_bar_height);
int render_y = navigation_bar_->bounds().bottom();
gfx::Size rwhv_size =
- gfx::Size(width(), std::max(0, height() - render_y + y()));
- render_view_container_->SetBounds(x(), render_y,
+ gfx::Size(width(), std::max(0, bounds.height() - render_y + bounds.y()));
+ render_view_container_->SetBounds(bounds.x(), render_y,
rwhv_size.width(), rwhv_size.height());
app_launcher_->rwhv_->SetSize(rwhv_size);
}
@@ -408,24 +410,27 @@ AppLauncher::~AppLauncher() {
}
// static
-AppLauncher* AppLauncher::Show(Browser* browser) {
+AppLauncher* AppLauncher::Show(Browser* browser, const gfx::Rect& bounds) {
AppLauncher* app_launcher = new AppLauncher(browser);
+ BrowserView* browser_view = static_cast<BrowserView*>(browser->window());
+ app_launcher->info_bubble_ =
+ InfoBubble::Show(browser_view->frame()->GetWindow(), bounds,
+ app_launcher->info_bubble_content_, app_launcher);
+ app_launcher->info_bubble_content_->BubbleShown();
+ return app_launcher;
+}
+// static
+AppLauncher* AppLauncher::ShowForNewTab(Browser* browser) {
BrowserView* browser_view = static_cast<BrowserView*>(browser->window());
TabStrip* tabstrip = browser_view->tabstrip()->AsTabStrip();
- if (!tabstrip) {
- delete app_launcher;
+ if (!tabstrip)
return NULL;
- }
gfx::Rect bounds = tabstrip->GetNewTabButtonBounds();
gfx::Point origin = bounds.origin();
views::RootView::ConvertPointToScreen(tabstrip, &origin);
bounds.set_origin(origin);
- app_launcher->info_bubble_ =
- InfoBubble::Show(browser_view->frame()->GetWindow(), bounds,
- app_launcher->info_bubble_content_, app_launcher);
- app_launcher->info_bubble_content_->BubbleShown();
- return app_launcher;
+ return Show(browser, bounds);
}
void AppLauncher::Hide() {
diff --git a/chrome/browser/views/app_launcher.h b/chrome/browser/views/app_launcher.h
index c641988..c98d435 100644
--- a/chrome/browser/views/app_launcher.h
+++ b/chrome/browser/views/app_launcher.h
@@ -55,10 +55,16 @@ class AppLauncher : public InfoBubbleDelegate,
public RenderViewHostDelegate,
public RenderViewHostDelegate::View {
public:
+ // Shows an application launcher bubble pointing to the |bounds| (which should
+ // be in screen coordinates).
+ // The caller DOES NOT OWN the AppLauncher returned. It is deleted
+ // automatically when the AppLauncher is closed.
+ static AppLauncher* Show(Browser* browser, const gfx::Rect& bounds);
+
// Shows an application launcher bubble pointing to the new tab button.
// The caller DOES NOT OWN the AppLauncher returned. It is deleted
// automatically when the AppLauncher is closed.
- static AppLauncher* Show(Browser* browser);
+ static AppLauncher* ShowForNewTab(Browser* browser);
// Returns the browser this AppLauncher is associated with.
Browser* browser() const { return browser_; }
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index c3da175..e5728af 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1417,7 +1417,8 @@ void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) {
switches::kAppLauncherForNewTab)) {
NavigationController& controller =
model_->GetSelectedTabContents()->controller();
- AppLauncher::Show(Browser::GetBrowserForController(&controller, NULL));
+ AppLauncher::ShowForNewTab(Browser::GetBrowserForController(&controller,
+ NULL));
return;
}
UserMetrics::RecordAction(UserMetricsAction("NewTab_Button"),