Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "athena/home/app_list_view_delegate.h" | 7 #include "athena/home/app_list_view_delegate.h" |
| 8 #include "athena/home/bottom_home_view.h" | |
| 8 #include "athena/home/minimized_home.h" | 9 #include "athena/home/minimized_home.h" |
| 9 #include "athena/home/public/app_model_builder.h" | 10 #include "athena/home/public/app_model_builder.h" |
| 10 #include "athena/input/public/accelerator_manager.h" | 11 #include "athena/input/public/accelerator_manager.h" |
| 11 #include "athena/screen/public/screen_manager.h" | 12 #include "athena/screen/public/screen_manager.h" |
| 12 #include "athena/wm/public/window_manager.h" | 13 #include "athena/wm/public/window_manager.h" |
| 13 #include "athena/wm/public/window_manager_observer.h" | 14 #include "athena/wm/public/window_manager_observer.h" |
| 14 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/command_line.h" | |
| 17 #include "ui/app_list/app_list_switches.h" | |
| 15 #include "ui/app_list/search_provider.h" | 18 #include "ui/app_list/search_provider.h" |
| 16 #include "ui/app_list/views/app_list_view.h" | 19 #include "ui/app_list/views/app_list_main_view.h" |
| 20 #include "ui/app_list/views/contents_view.h" | |
| 17 #include "ui/aura/layout_manager.h" | 21 #include "ui/aura/layout_manager.h" |
| 18 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/views/background.h" | |
| 19 #include "ui/views/layout/box_layout.h" | 24 #include "ui/views/layout/box_layout.h" |
| 25 #include "ui/views/widget/widget.h" | |
| 26 #include "ui/views/widget/widget_delegate.h" | |
| 20 #include "ui/wm/core/visibility_controller.h" | 27 #include "ui/wm/core/visibility_controller.h" |
| 21 #include "ui/wm/core/window_animations.h" | 28 #include "ui/wm/core/window_animations.h" |
| 22 | 29 |
| 23 namespace athena { | 30 namespace athena { |
| 24 namespace { | 31 namespace { |
| 25 | 32 |
| 26 HomeCard* instance = NULL; | 33 HomeCard* instance = NULL; |
| 27 | 34 |
| 28 // Makes sure the homecard is center-aligned horizontally and bottom-aligned | 35 // Makes sure the homecard is center-aligned horizontally and bottom-aligned |
| 29 // vertically. | 36 // vertically. |
| 30 class HomeCardLayoutManager : public aura::LayoutManager { | 37 class HomeCardLayoutManager : public aura::LayoutManager { |
| 31 public: | 38 public: |
| 32 class Delegate { | 39 class Delegate { |
| 33 public: | 40 public: |
| 34 virtual ~Delegate() {} | 41 virtual ~Delegate() {} |
| 35 | 42 |
| 36 virtual int GetHomeCardHeight() const = 0; | 43 virtual int GetHomeCardHeight() const = 0; |
| 37 | 44 |
| 38 virtual int GetHorizontalMargin() const = 0; | 45 virtual int GetHorizontalMargin() const = 0; |
| 39 | 46 |
| 40 // TODO(mukai): Remove this when bubble is no longer used for | |
| 41 // VISIBLE_CENTERED or VISIBLE_BOTTOM states. | |
| 42 virtual bool HasShadow() const = 0; | |
| 43 | |
| 44 virtual aura::Window* GetNativeWindow() = 0; | 47 virtual aura::Window* GetNativeWindow() = 0; |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 explicit HomeCardLayoutManager(Delegate* delegate) | 50 explicit HomeCardLayoutManager(Delegate* delegate) |
| 48 : delegate_(delegate) {} | 51 : delegate_(delegate) {} |
| 52 | |
| 49 virtual ~HomeCardLayoutManager() {} | 53 virtual ~HomeCardLayoutManager() {} |
| 50 | 54 |
| 51 void UpdateVirtualKeyboardBounds(const gfx::Rect& bounds) { | 55 void Layout() { |
| 52 virtual_keyboard_bounds_ = bounds; | 56 aura::Window* home_card = delegate_->GetNativeWindow(); |
| 53 Layout(); | 57 // |home_card| could be detached from the root window (e.g. when it is being |
| 58 // destroyed). | |
| 59 if (!home_card || !home_card->GetRootWindow()) | |
| 60 return; | |
| 61 | |
| 62 int height = delegate_->GetHomeCardHeight(); | |
| 63 int horiz_margin = delegate_->GetHorizontalMargin(); | |
| 64 gfx::Rect screen_bounds = home_card->GetRootWindow()->bounds(); | |
| 65 height = std::min(height, screen_bounds.height()); | |
| 66 gfx::Rect card_bounds = screen_bounds; | |
| 67 card_bounds.Inset(horiz_margin, screen_bounds.height() - height, | |
| 68 horiz_margin, 0); | |
| 69 | |
| 70 SetChildBoundsDirect(home_card, card_bounds); | |
| 54 } | 71 } |
| 55 | 72 |
| 56 private: | 73 private: |
| 57 // aura::LayoutManager: | 74 // aura::LayoutManager: |
| 58 virtual void OnWindowResized() OVERRIDE { Layout(); } | 75 virtual void OnWindowResized() OVERRIDE { Layout(); } |
| 59 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { Layout(); } | 76 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { Layout(); } |
| 60 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | 77 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
| 61 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE { | 78 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE { |
| 62 Layout(); | 79 Layout(); |
| 63 } | 80 } |
| 64 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 81 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 65 bool visible) OVERRIDE { | 82 bool visible) OVERRIDE { |
| 66 Layout(); | 83 Layout(); |
| 67 } | 84 } |
| 68 virtual void SetChildBounds(aura::Window* child, | 85 virtual void SetChildBounds(aura::Window* child, |
| 69 const gfx::Rect& requested_bounds) OVERRIDE { | 86 const gfx::Rect& requested_bounds) OVERRIDE { |
| 70 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size())); | 87 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size())); |
| 71 } | 88 } |
| 72 | 89 |
| 73 void Layout() { | |
| 74 int height = delegate_->GetHomeCardHeight(); | |
| 75 int horiz_margin = delegate_->GetHorizontalMargin(); | |
| 76 aura::Window* home_card = delegate_->GetNativeWindow(); | |
| 77 // |home_card| could be detached from the root window (e.g. when it is being | |
| 78 // destroyed). | |
| 79 if (!home_card || !home_card->GetRootWindow()) | |
| 80 return; | |
| 81 | |
| 82 gfx::Rect screen_bounds = home_card->GetRootWindow()->bounds(); | |
| 83 if (!virtual_keyboard_bounds_.IsEmpty()) | |
| 84 screen_bounds.set_height(virtual_keyboard_bounds_.y()); | |
| 85 gfx::Rect card_bounds = screen_bounds; | |
| 86 card_bounds.Inset(horiz_margin, screen_bounds.height() - height, | |
| 87 horiz_margin, 0); | |
| 88 | |
| 89 if (delegate_->HasShadow()) { | |
| 90 // Currently the home card is provided as a bubble and the bounds has to | |
| 91 // be increased to cancel the shadow. | |
| 92 // TODO(mukai): stops using the bubble and remove this. | |
| 93 const int kHomeCardShadowWidth = 30; | |
| 94 card_bounds.Inset(-kHomeCardShadowWidth, -kHomeCardShadowWidth); | |
| 95 } | |
| 96 SetChildBoundsDirect(home_card, card_bounds); | |
| 97 } | |
| 98 | |
| 99 Delegate* delegate_; | 90 Delegate* delegate_; |
| 100 gfx::Rect virtual_keyboard_bounds_; | |
| 101 | 91 |
| 102 DISALLOW_COPY_AND_ASSIGN(HomeCardLayoutManager); | 92 DISALLOW_COPY_AND_ASSIGN(HomeCardLayoutManager); |
| 103 }; | 93 }; |
| 104 | 94 |
| 95 // The container view of home card contents of each state. | |
| 96 class HomeCardView : public views::WidgetDelegateView { | |
| 97 public: | |
| 98 HomeCardView(app_list::AppListViewDelegate* view_delegate, | |
| 99 aura::Window* container, | |
| 100 MinimizedHomeDragDelegate* minimized_delegate) { | |
| 101 set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); | |
| 102 views::BoxLayout* layout = new views::BoxLayout( | |
| 103 views::BoxLayout::kHorizontal, 0, 0, 0); | |
| 104 layout->set_main_axis_alignment( | |
| 105 views::BoxLayout::MAIN_AXIS_ALIGNMENT_FILL); | |
| 106 layout->set_cross_axis_alignment( | |
| 107 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | |
| 108 SetLayoutManager(layout); | |
| 109 | |
| 110 bottom_view_ = new BottomHomeView(view_delegate); | |
| 111 AddChildView(bottom_view_); | |
| 112 | |
| 113 main_view_ = new app_list::AppListMainView( | |
| 114 view_delegate, 0 /* initial_apps_page */, container); | |
| 115 AddChildView(main_view_); | |
| 116 | |
| 117 minimized_view_ = CreateMinimizedHome(minimized_delegate); | |
| 118 AddChildView(minimized_view_); | |
| 119 } | |
| 120 | |
| 121 void SetState(HomeCard::State state) { | |
| 122 bottom_view_->SetVisible(state == HomeCard::VISIBLE_BOTTOM); | |
| 123 main_view_->SetVisible(state == HomeCard::VISIBLE_CENTERED); | |
| 124 minimized_view_->SetVisible(state == HomeCard::VISIBLE_MINIMIZED); | |
| 125 if (state == HomeCard::VISIBLE_CENTERED) { | |
| 126 app_list::ContentsView* contents_view = main_view_->contents_view(); | |
| 127 contents_view->SetActivePage(contents_view->GetPageIndexForNamedPage( | |
| 128 app_list::ContentsView::NAMED_PAGE_START)); | |
| 129 } | |
| 130 Layout(); | |
| 131 } | |
| 132 | |
| 133 private: | |
| 134 // views::WidgetDelegate: | |
| 135 virtual views::View* GetContentsView() OVERRIDE { | |
| 136 return this; | |
| 137 } | |
| 138 | |
| 139 app_list::AppListMainView* main_view_; | |
| 140 BottomHomeView* bottom_view_; | |
| 141 views::View* minimized_view_; | |
| 142 | |
| 143 DISALLOW_COPY_AND_ASSIGN(HomeCardView); | |
| 144 }; | |
| 145 | |
| 105 class HomeCardImpl : public HomeCard, | 146 class HomeCardImpl : public HomeCard, |
| 106 public AcceleratorHandler, | 147 public AcceleratorHandler, |
| 107 public HomeCardLayoutManager::Delegate, | 148 public HomeCardLayoutManager::Delegate, |
| 108 public MinimizedHomeDragDelegate, | 149 public MinimizedHomeDragDelegate, |
| 109 public WindowManagerObserver { | 150 public WindowManagerObserver { |
| 110 public: | 151 public: |
| 111 explicit HomeCardImpl(AppModelBuilder* model_builder); | 152 explicit HomeCardImpl(AppModelBuilder* model_builder); |
| 112 virtual ~HomeCardImpl(); | 153 virtual ~HomeCardImpl(); |
| 113 | 154 |
| 114 void Init(); | 155 void Init(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 135 SetState(VISIBLE_CENTERED); | 176 SetState(VISIBLE_CENTERED); |
| 136 else | 177 else |
| 137 SetState(HIDDEN); | 178 SetState(HIDDEN); |
| 138 return true; | 179 return true; |
| 139 } | 180 } |
| 140 | 181 |
| 141 // HomeCardLayoutManager::Delegate: | 182 // HomeCardLayoutManager::Delegate: |
| 142 virtual int GetHomeCardHeight() const OVERRIDE { | 183 virtual int GetHomeCardHeight() const OVERRIDE { |
| 143 const int kHomeCardHeight = 150; | 184 const int kHomeCardHeight = 150; |
| 144 const int kHomeCardMinimizedHeight = 8; | 185 const int kHomeCardMinimizedHeight = 8; |
| 145 CHECK_NE(HIDDEN, state_); | 186 |
| 146 return state_ == VISIBLE_MINIMIZED ? kHomeCardMinimizedHeight : | 187 switch (state_) { |
| 147 kHomeCardHeight; | 188 case VISIBLE_CENTERED: |
| 189 // Span the screen fully. | |
| 190 return kint32max; | |
| 191 case VISIBLE_BOTTOM: | |
| 192 return kHomeCardHeight; | |
| 193 case VISIBLE_MINIMIZED: | |
| 194 return kHomeCardMinimizedHeight; | |
| 195 default: | |
| 196 NOTREACHED(); | |
| 197 return -1; | |
| 198 } | |
| 148 } | 199 } |
| 149 | 200 |
| 150 virtual int GetHorizontalMargin() const OVERRIDE { | 201 virtual int GetHorizontalMargin() const OVERRIDE { |
| 151 CHECK_NE(HIDDEN, state_); | 202 CHECK_NE(HIDDEN, state_); |
| 152 const int kHomeCardHorizontalMargin = 50; | 203 const int kHomeCardHorizontalMargin = 50; |
| 153 return state_ == VISIBLE_MINIMIZED ? 0 : kHomeCardHorizontalMargin; | 204 return state_ == VISIBLE_BOTTOM ? kHomeCardHorizontalMargin : 0; |
| 154 } | |
| 155 | |
| 156 virtual bool HasShadow() const OVERRIDE { | |
| 157 CHECK_NE(HIDDEN, state_); | |
| 158 return state_ != VISIBLE_MINIMIZED; | |
| 159 } | 205 } |
| 160 | 206 |
| 161 virtual aura::Window* GetNativeWindow() OVERRIDE { | 207 virtual aura::Window* GetNativeWindow() OVERRIDE { |
| 162 switch (state_) { | 208 if (state_ == HIDDEN) |
| 163 case HIDDEN: | 209 return NULL; |
| 164 return NULL; | 210 |
| 165 case VISIBLE_MINIMIZED: | 211 return home_card_widget_ ? home_card_widget_->GetNativeWindow() : NULL; |
| 166 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : NULL; | |
| 167 case VISIBLE_CENTERED: | |
| 168 case VISIBLE_BOTTOM: | |
| 169 return home_card_widget_ ? home_card_widget_->GetNativeWindow() : NULL; | |
| 170 } | |
| 171 return NULL; | |
| 172 } | 212 } |
| 173 | 213 |
| 174 // MinimizedHomeDragDelegate: | 214 // MinimizedHomeDragDelegate: |
| 175 virtual void OnDragUpCompleted() OVERRIDE { | 215 virtual void OnDragUpCompleted() OVERRIDE { |
| 176 WindowManager::GetInstance()->ToggleOverview(); | 216 WindowManager::GetInstance()->ToggleOverview(); |
| 177 } | 217 } |
| 178 | 218 |
| 179 // WindowManagerObserver: | 219 // WindowManagerObserver: |
| 180 virtual void OnOverviewModeEnter() OVERRIDE { | 220 virtual void OnOverviewModeEnter() OVERRIDE { |
| 181 SetState(VISIBLE_BOTTOM); | 221 SetState(VISIBLE_BOTTOM); |
| 182 } | 222 } |
| 183 | 223 |
| 184 virtual void OnOverviewModeExit() OVERRIDE { | 224 virtual void OnOverviewModeExit() OVERRIDE { |
| 185 SetState(VISIBLE_MINIMIZED); | 225 SetState(VISIBLE_MINIMIZED); |
| 186 } | 226 } |
| 187 | 227 |
| 188 scoped_ptr<AppModelBuilder> model_builder_; | 228 scoped_ptr<AppModelBuilder> model_builder_; |
| 189 | 229 |
| 190 HomeCard::State state_; | 230 HomeCard::State state_; |
| 231 HomeCard::State original_state_; | |
| 191 | 232 |
| 192 views::Widget* home_card_widget_; | 233 views::Widget* home_card_widget_; |
| 193 views::Widget* minimized_widget_; | 234 HomeCardView* home_card_view_; |
| 194 AppListViewDelegate* view_delegate_; | 235 scoped_ptr<AppListViewDelegate> view_delegate_; |
| 195 HomeCardLayoutManager* layout_manager_; | 236 HomeCardLayoutManager* layout_manager_; |
| 196 | 237 |
| 197 // Right now HomeCard allows only one search provider. | 238 // Right now HomeCard allows only one search provider. |
| 198 // TODO(mukai): port app-list's SearchController and Mixer. | 239 // TODO(mukai): port app-list's SearchController and Mixer. |
| 199 scoped_ptr<app_list::SearchProvider> search_provider_; | 240 scoped_ptr<app_list::SearchProvider> search_provider_; |
| 200 | 241 |
| 201 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); | 242 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); |
| 202 }; | 243 }; |
| 203 | 244 |
| 204 HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) | 245 HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) |
| 205 : model_builder_(model_builder), | 246 : model_builder_(model_builder), |
| 206 state_(VISIBLE_MINIMIZED), | 247 state_(VISIBLE_MINIMIZED), |
| 248 original_state_(VISIBLE_MINIMIZED), | |
| 207 home_card_widget_(NULL), | 249 home_card_widget_(NULL), |
| 208 minimized_widget_(NULL), | 250 home_card_view_(NULL), |
| 209 layout_manager_(NULL) { | 251 layout_manager_(NULL) { |
| 210 DCHECK(!instance); | 252 DCHECK(!instance); |
| 211 instance = this; | 253 instance = this; |
| 212 WindowManager::GetInstance()->AddObserver(this); | 254 WindowManager::GetInstance()->AddObserver(this); |
| 213 } | 255 } |
| 214 | 256 |
| 215 HomeCardImpl::~HomeCardImpl() { | 257 HomeCardImpl::~HomeCardImpl() { |
| 216 DCHECK(instance); | 258 DCHECK(instance); |
| 217 WindowManager::GetInstance()->RemoveObserver(this); | 259 WindowManager::GetInstance()->RemoveObserver(this); |
| 218 home_card_widget_->CloseNow(); | 260 home_card_widget_->CloseNow(); |
| 219 minimized_widget_->CloseNow(); | |
| 220 view_delegate_ = NULL; | |
| 221 instance = NULL; | 261 instance = NULL; |
| 222 } | 262 } |
| 223 | 263 |
| 224 void HomeCardImpl::SetState(HomeCard::State state) { | 264 void HomeCardImpl::SetState(HomeCard::State state) { |
| 225 // Update |state_| before changing the visibility of the widgets, so that | 265 // Update |state_| before changing the visibility of the widgets, so that |
| 226 // LayoutManager callbacks get the correct state. | 266 // LayoutManager callbacks get the correct state. |
| 227 state_ = state; | 267 state_ = state; |
| 228 switch (state_) { | 268 original_state_ = state; |
| 229 case VISIBLE_MINIMIZED: | 269 if (state_ == HIDDEN) { |
| 230 home_card_widget_->Hide(); | 270 home_card_widget_->Hide(); |
| 231 minimized_widget_->Show(); | 271 } else { |
| 232 break; | 272 home_card_widget_->Show(); |
| 233 case HIDDEN: | 273 home_card_view_->SetState(state); |
| 234 home_card_widget_->Hide(); | 274 layout_manager_->Layout(); |
| 235 minimized_widget_->Hide(); | |
| 236 break; | |
| 237 case VISIBLE_BOTTOM: | |
| 238 case VISIBLE_CENTERED: | |
| 239 home_card_widget_->Show(); | |
| 240 minimized_widget_->Hide(); | |
| 241 break; | |
| 242 } | 275 } |
| 243 } | 276 } |
| 244 | 277 |
| 245 void HomeCardImpl::RegisterSearchProvider( | 278 void HomeCardImpl::RegisterSearchProvider( |
| 246 app_list::SearchProvider* search_provider) { | 279 app_list::SearchProvider* search_provider) { |
| 247 DCHECK(!search_provider_); | 280 DCHECK(!search_provider_); |
| 248 search_provider_.reset(search_provider); | 281 search_provider_.reset(search_provider); |
| 249 view_delegate_->RegisterSearchProvider(search_provider_.get()); | 282 view_delegate_->RegisterSearchProvider(search_provider_.get()); |
| 250 } | 283 } |
| 251 | 284 |
| 252 void HomeCardImpl::UpdateVirtualKeyboardBounds( | 285 void HomeCardImpl::UpdateVirtualKeyboardBounds( |
| 253 const gfx::Rect& bounds) { | 286 const gfx::Rect& bounds) { |
| 254 if (state_ == VISIBLE_MINIMIZED) { | 287 if (state_ == VISIBLE_BOTTOM && !bounds.IsEmpty()) { |
| 255 if (bounds.IsEmpty()) | 288 SetState(VISIBLE_CENTERED); |
| 256 minimized_widget_->Show(); | 289 original_state_ = VISIBLE_BOTTOM; |
|
oshima
2014/07/17 22:11:59
you can record "previous state" in SetState, and y
oshima
2014/07/19 04:00:13
you probably missed this comment.
Jun Mukai
2014/07/21 17:30:52
Oops, sorry.
Well, however, I don't think keeping
| |
| 257 else | 290 } else if (state_ == VISIBLE_CENTERED && original_state_ == VISIBLE_BOTTOM && |
| 258 minimized_widget_->Hide(); | 291 bounds.IsEmpty()) { |
| 292 SetState(VISIBLE_BOTTOM); | |
| 259 } | 293 } |
| 260 layout_manager_->UpdateVirtualKeyboardBounds(bounds); | |
| 261 } | 294 } |
| 262 | 295 |
| 263 void HomeCardImpl::Init() { | 296 void HomeCardImpl::Init() { |
| 264 InstallAccelerators(); | 297 InstallAccelerators(); |
| 265 | 298 |
| 266 aura::Window* container = | 299 aura::Window* container = |
| 267 ScreenManager::Get()->CreateContainer("HomeCardContainer"); | 300 ScreenManager::Get()->CreateContainer("HomeCardContainer"); |
| 268 layout_manager_ = new HomeCardLayoutManager(this); | 301 layout_manager_ = new HomeCardLayoutManager(this); |
| 269 container->SetLayoutManager(layout_manager_); | 302 container->SetLayoutManager(layout_manager_); |
| 270 wm::SetChildWindowVisibilityChangesAnimated(container); | 303 wm::SetChildWindowVisibilityChangesAnimated(container); |
| 271 | 304 |
| 272 view_delegate_ = new AppListViewDelegate(model_builder_.get()); | 305 view_delegate_.reset(new AppListViewDelegate(model_builder_.get())); |
| 273 if (search_provider_) | 306 if (search_provider_) |
| 274 view_delegate_->RegisterSearchProvider(search_provider_.get()); | 307 view_delegate_->RegisterSearchProvider(search_provider_.get()); |
| 275 app_list::AppListView* view = new app_list::AppListView(view_delegate_); | |
| 276 view->InitAsBubbleAtFixedLocation( | |
| 277 container, | |
| 278 0 /* initial_apps_page */, | |
| 279 gfx::Point(), | |
| 280 views::BubbleBorder::FLOAT, | |
| 281 true /* border_accepts_events */); | |
| 282 home_card_widget_ = view->GetWidget(); | |
| 283 | 308 |
| 284 // Start off in the minimized state. | 309 // Force showing in the experimental app-list view. |
| 285 minimized_widget_ = CreateMinimizedHome(container, this); | 310 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 311 app_list::switches::kEnableExperimentalAppList); | |
| 312 | |
| 313 home_card_view_ = new HomeCardView(view_delegate_.get(), container, this); | |
| 314 home_card_widget_ = new views::Widget(); | |
| 315 views::Widget::InitParams params( | |
| 316 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
| 317 params.parent = container; | |
| 318 params.delegate = home_card_view_; | |
| 319 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | |
| 320 home_card_widget_->Init(params); | |
| 321 | |
| 286 SetState(VISIBLE_MINIMIZED); | 322 SetState(VISIBLE_MINIMIZED); |
| 287 } | 323 } |
| 288 | 324 |
| 289 void HomeCardImpl::InstallAccelerators() { | 325 void HomeCardImpl::InstallAccelerators() { |
| 290 const AcceleratorData accelerator_data[] = { | 326 const AcceleratorData accelerator_data[] = { |
| 291 {TRIGGER_ON_PRESS, ui::VKEY_L, ui::EF_CONTROL_DOWN, | 327 {TRIGGER_ON_PRESS, ui::VKEY_L, ui::EF_CONTROL_DOWN, |
| 292 COMMAND_SHOW_HOME_CARD, AF_NONE}, | 328 COMMAND_SHOW_HOME_CARD, AF_NONE}, |
| 293 }; | 329 }; |
| 294 AcceleratorManager::Get()->RegisterAccelerators( | 330 AcceleratorManager::Get()->RegisterAccelerators( |
| 295 accelerator_data, arraysize(accelerator_data), this); | 331 accelerator_data, arraysize(accelerator_data), this); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 311 instance = NULL; | 347 instance = NULL; |
| 312 } | 348 } |
| 313 | 349 |
| 314 // static | 350 // static |
| 315 HomeCard* HomeCard::Get() { | 351 HomeCard* HomeCard::Get() { |
| 316 DCHECK(instance); | 352 DCHECK(instance); |
| 317 return instance; | 353 return instance; |
| 318 } | 354 } |
| 319 | 355 |
| 320 } // namespace athena | 356 } // namespace athena |
| OLD | NEW |