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

Unified Diff: ash/launcher/launcher.cc

Issue 9703026: Makes the maximize/restore button handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years, 9 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 | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher.cc
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index f5c9cc7e0c7f1e39bec6e37844291306c243bcf5..516c0360dde18cecc1c24a022fac5242c6db7af7 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -96,7 +96,8 @@ void Launcher::DelegateView::Layout() {
Launcher::Launcher(aura::Window* window_container)
: widget_(NULL),
window_container_(window_container),
- delegate_view_(NULL) {
+ delegate_view_(NULL),
+ launcher_view_(NULL) {
model_.reset(new LauncherModel);
if (Shell::GetInstance()->delegate()) {
delegate_.reset(
@@ -111,15 +112,15 @@ Launcher::Launcher(aura::Window* window_container)
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = Shell::GetInstance()->GetContainer(
ash::internal::kShellWindowId_LauncherContainer);
- internal::LauncherView* launcher_view =
- new internal::LauncherView(model_.get(), delegate_.get());
- launcher_view->Init();
+ launcher_view_ = new internal::LauncherView(model_.get(), delegate_.get());
+ launcher_view_->Init();
delegate_view_ = new DelegateView;
- delegate_view_->AddChildView(launcher_view);
+ delegate_view_->AddChildView(launcher_view_);
params.delegate = delegate_view_;
widget_->Init(params);
widget_->GetNativeWindow()->SetName("LauncherWindow");
- gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize();
+ gfx::Size pref =
+ static_cast<views::View*>(launcher_view_)->GetPreferredSize();
widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height()));
// The launcher should not take focus when it is initially shown.
widget_->set_focus_on_creation(false);
@@ -139,4 +140,21 @@ int Launcher::GetStatusWidth() {
return delegate_view_->status_width();
}
+gfx::Rect Launcher::GetScreenBoundsOfItemIconForWindow(aura::Window* window) {
+ if (!delegate_.get())
+ return gfx::Rect();
+
+ LauncherID id = delegate_->GetIDByWindow(window);
+ gfx::Rect bounds(launcher_view_->GetIdealBoundsOfItemIcon(id));
+ if (bounds.IsEmpty())
+ return bounds;
+
+ gfx::Point screen_origin;
+ views::View::ConvertPointToScreen(launcher_view_, &screen_origin);
+ return gfx::Rect(screen_origin.x() + bounds.x(),
+ screen_origin.y() + bounds.y(),
+ bounds.width(),
+ bounds.height());
+}
+
} // namespace ash
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698