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

Side by Side Diff: athena/home/home_card_impl.cc

Issue 455543004: Use ShadowController instead of creating its own. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | athena/wm/window_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/home/public/home_card.h" 5 #include "athena/home/public/home_card.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "athena/common/container_priorities.h" 10 #include "athena/common/container_priorities.h"
11 #include "athena/home/app_list_view_delegate.h" 11 #include "athena/home/app_list_view_delegate.h"
12 #include "athena/home/bottom_home_view.h" 12 #include "athena/home/bottom_home_view.h"
13 #include "athena/home/minimized_home.h" 13 #include "athena/home/minimized_home.h"
14 #include "athena/home/public/app_model_builder.h" 14 #include "athena/home/public/app_model_builder.h"
15 #include "athena/input/public/accelerator_manager.h" 15 #include "athena/input/public/accelerator_manager.h"
16 #include "athena/screen/public/screen_manager.h" 16 #include "athena/screen/public/screen_manager.h"
17 #include "athena/wm/public/window_manager.h" 17 #include "athena/wm/public/window_manager.h"
18 #include "athena/wm/public/window_manager_observer.h" 18 #include "athena/wm/public/window_manager_observer.h"
19 #include "base/bind.h" 19 #include "base/bind.h"
20 #include "ui/app_list/search_provider.h" 20 #include "ui/app_list/search_provider.h"
21 #include "ui/app_list/views/app_list_main_view.h" 21 #include "ui/app_list/views/app_list_main_view.h"
22 #include "ui/app_list/views/contents_view.h" 22 #include "ui/app_list/views/contents_view.h"
23 #include "ui/aura/layout_manager.h" 23 #include "ui/aura/layout_manager.h"
24 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
25 #include "ui/views/background.h" 25 #include "ui/views/background.h"
26 #include "ui/views/layout/box_layout.h" 26 #include "ui/views/layout/box_layout.h"
27 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
28 #include "ui/views/widget/widget_delegate.h" 28 #include "ui/views/widget/widget_delegate.h"
29 #include "ui/wm/core/shadow.h" 29 #include "ui/wm/core/shadow_types.h"
30 #include "ui/wm/core/visibility_controller.h" 30 #include "ui/wm/core/visibility_controller.h"
31 #include "ui/wm/core/window_animations.h" 31 #include "ui/wm/core/window_animations.h"
32 #include "ui/wm/public/activation_change_observer.h" 32 #include "ui/wm/public/activation_change_observer.h"
33 #include "ui/wm/public/activation_client.h" 33 #include "ui/wm/public/activation_client.h"
34 34
35 namespace athena { 35 namespace athena {
36 namespace { 36 namespace {
37 37
38 HomeCard* instance = NULL; 38 HomeCard* instance = NULL;
39 39
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 void SetState(HomeCard::State state) { 285 void SetState(HomeCard::State state) {
286 bottom_view_->SetVisible(state == HomeCard::VISIBLE_BOTTOM); 286 bottom_view_->SetVisible(state == HomeCard::VISIBLE_BOTTOM);
287 main_view_->SetVisible(state == HomeCard::VISIBLE_CENTERED); 287 main_view_->SetVisible(state == HomeCard::VISIBLE_CENTERED);
288 minimized_view_->SetVisible(state == HomeCard::VISIBLE_MINIMIZED); 288 minimized_view_->SetVisible(state == HomeCard::VISIBLE_MINIMIZED);
289 if (state == HomeCard::VISIBLE_CENTERED) { 289 if (state == HomeCard::VISIBLE_CENTERED) {
290 app_list::ContentsView* contents_view = main_view_->contents_view(); 290 app_list::ContentsView* contents_view = main_view_->contents_view();
291 contents_view->SetActivePage(contents_view->GetPageIndexForNamedPage( 291 contents_view->SetActivePage(contents_view->GetPageIndexForNamedPage(
292 app_list::ContentsView::NAMED_PAGE_START)); 292 app_list::ContentsView::NAMED_PAGE_START));
293 } 293 }
294 294 wm::SetShadowType(GetWidget()->GetNativeView(),
295 if (state == HomeCard::VISIBLE_MINIMIZED) 295 state == HomeCard::VISIBLE_MINIMIZED ?
296 shadow_.reset(); 296 wm::SHADOW_TYPE_NONE :
297 // Do not create the shadow yet. Instead, create it in OnWidgetMove(), to 297 wm::SHADOW_TYPE_RECTANGULAR);
298 // make sure that widget has been resized correctly (because the size of the
299 // shadow depends on the size of the widget).
300 } 298 }
301 299
302 void ClearGesture() { 300 void ClearGesture() {
303 gesture_manager_.reset(); 301 gesture_manager_.reset();
304 } 302 }
305 303
306 // views::View: 304 // views::View:
307 virtual void Layout() OVERRIDE { 305 virtual void Layout() OVERRIDE {
308 for (int i = 0; i < child_count(); ++i) { 306 for (int i = 0; i < child_count(); ++i) {
309 views::View* child = child_at(i); 307 views::View* child = child_at(i);
(...skipping 12 matching lines...) Expand all
322 gesture_manager_.reset(new HomeCardGestureManager( 320 gesture_manager_.reset(new HomeCardGestureManager(
323 gesture_delegate_, 321 gesture_delegate_,
324 GetWidget()->GetNativeWindow()->GetRootWindow()->bounds())); 322 GetWidget()->GetNativeWindow()->GetRootWindow()->bounds()));
325 } 323 }
326 324
327 if (gesture_manager_) 325 if (gesture_manager_)
328 gesture_manager_->ProcessGestureEvent(event); 326 gesture_manager_->ProcessGestureEvent(event);
329 } 327 }
330 328
331 private: 329 private:
332 // views::WidgetDelegate:
333 virtual void OnWidgetMove() OVERRIDE {
334 if (!minimized_view_->visible()) {
335 aura::Window* window = GetWidget()->GetNativeWindow();
336 if (!shadow_) {
337 shadow_.reset(new wm::Shadow());
338 shadow_->Init(wm::Shadow::STYLE_ACTIVE);
339 shadow_->SetContentBounds(gfx::Rect(window->bounds().size()));
340 shadow_->layer()->SetVisible(true);
341
342 ui::Layer* layer = window->layer();
343 layer->Add(shadow_->layer());
344 } else {
345 shadow_->SetContentBounds(gfx::Rect(window->bounds().size()));
346 }
347 }
348 }
349
350 virtual views::View* GetContentsView() OVERRIDE { 330 virtual views::View* GetContentsView() OVERRIDE {
351 return this; 331 return this;
352 } 332 }
353 333
354 app_list::AppListMainView* main_view_; 334 app_list::AppListMainView* main_view_;
355 BottomHomeView* bottom_view_; 335 BottomHomeView* bottom_view_;
356 views::View* minimized_view_; 336 views::View* minimized_view_;
357 scoped_ptr<wm::Shadow> shadow_;
358 scoped_ptr<HomeCardGestureManager> gesture_manager_; 337 scoped_ptr<HomeCardGestureManager> gesture_manager_;
359 HomeCardGestureManager::Delegate* gesture_delegate_; 338 HomeCardGestureManager::Delegate* gesture_delegate_;
360 339
361 DISALLOW_COPY_AND_ASSIGN(HomeCardView); 340 DISALLOW_COPY_AND_ASSIGN(HomeCardView);
362 }; 341 };
363 342
364 class HomeCardImpl : public HomeCard, 343 class HomeCardImpl : public HomeCard,
365 public AcceleratorHandler, 344 public AcceleratorHandler,
366 public HomeCardLayoutManager::Delegate, 345 public HomeCardLayoutManager::Delegate,
367 public HomeCardGestureManager::Delegate, 346 public HomeCardGestureManager::Delegate,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 instance = NULL; 579 instance = NULL;
601 } 580 }
602 581
603 // static 582 // static
604 HomeCard* HomeCard::Get() { 583 HomeCard* HomeCard::Get() {
605 DCHECK(instance); 584 DCHECK(instance);
606 return instance; 585 return instance;
607 } 586 }
608 587
609 } // namespace athena 588 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/wm/window_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698