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 app_list::AppListMainView* main_view() { | |
| 122 return main_view_; | |
| 123 } | |
| 124 BottomHomeView* bottom_view() { | |
| 125 return bottom_view_; | |
| 126 } | |
| 127 views::View* minimized_view() { | |
| 128 return minimized_view_; | |
| 129 } | |
| 130 | |
| 131 private: | |
| 132 // views::WidgetDelegate: | |
| 133 virtual views::View* GetContentsView() OVERRIDE { | |
| 134 return this; | |
| 135 } | |
| 136 | |
| 137 app_list::AppListMainView* main_view_; | |
| 138 BottomHomeView* bottom_view_; | |
| 139 views::View* minimized_view_; | |
| 140 | |
| 141 DISALLOW_COPY_AND_ASSIGN(HomeCardView); | |
| 142 }; | |
| 143 | |
| 105 class HomeCardImpl : public HomeCard, | 144 class HomeCardImpl : public HomeCard, |
| 106 public AcceleratorHandler, | 145 public AcceleratorHandler, |
| 107 public HomeCardLayoutManager::Delegate, | 146 public HomeCardLayoutManager::Delegate, |
| 108 public MinimizedHomeDragDelegate, | 147 public MinimizedHomeDragDelegate, |
| 109 public WindowManagerObserver { | 148 public WindowManagerObserver { |
| 110 public: | 149 public: |
| 111 explicit HomeCardImpl(AppModelBuilder* model_builder); | 150 explicit HomeCardImpl(AppModelBuilder* model_builder); |
| 112 virtual ~HomeCardImpl(); | 151 virtual ~HomeCardImpl(); |
| 113 | 152 |
| 114 void Init(); | 153 void Init(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 135 SetState(VISIBLE_CENTERED); | 174 SetState(VISIBLE_CENTERED); |
| 136 else | 175 else |
| 137 SetState(HIDDEN); | 176 SetState(HIDDEN); |
| 138 return true; | 177 return true; |
| 139 } | 178 } |
| 140 | 179 |
| 141 // HomeCardLayoutManager::Delegate: | 180 // HomeCardLayoutManager::Delegate: |
| 142 virtual int GetHomeCardHeight() const OVERRIDE { | 181 virtual int GetHomeCardHeight() const OVERRIDE { |
| 143 const int kHomeCardHeight = 150; | 182 const int kHomeCardHeight = 150; |
| 144 const int kHomeCardMinimizedHeight = 8; | 183 const int kHomeCardMinimizedHeight = 8; |
| 145 CHECK_NE(HIDDEN, state_); | 184 |
| 146 return state_ == VISIBLE_MINIMIZED ? kHomeCardMinimizedHeight : | 185 switch (state_) { |
| 147 kHomeCardHeight; | 186 case VISIBLE_CENTERED: |
| 187 // Span the screen fully. | |
| 188 return kint32max; | |
|
sadrul
2014/07/17 22:01:39
Looks like this is deprecated in favour of std::nu
Jun Mukai
2014/07/17 22:12:56
Done.
| |
| 189 case VISIBLE_BOTTOM: | |
| 190 return kHomeCardHeight; | |
| 191 case VISIBLE_MINIMIZED: | |
| 192 return kHomeCardMinimizedHeight; | |
| 193 default: | |
|
sadrul
2014/07/17 22:01:38
Use HIDDEN here, so if there's a new state, the co
Jun Mukai
2014/07/17 22:12:56
Done.
| |
| 194 NOTREACHED(); | |
| 195 return -1; | |
| 196 } | |
| 148 } | 197 } |
| 149 | 198 |
| 150 virtual int GetHorizontalMargin() const OVERRIDE { | 199 virtual int GetHorizontalMargin() const OVERRIDE { |
| 151 CHECK_NE(HIDDEN, state_); | 200 CHECK_NE(HIDDEN, state_); |
| 152 const int kHomeCardHorizontalMargin = 50; | 201 const int kHomeCardHorizontalMargin = 50; |
| 153 return state_ == VISIBLE_MINIMIZED ? 0 : kHomeCardHorizontalMargin; | 202 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 } | 203 } |
| 160 | 204 |
| 161 virtual aura::Window* GetNativeWindow() OVERRIDE { | 205 virtual aura::Window* GetNativeWindow() OVERRIDE { |
| 162 switch (state_) { | 206 if (state_ == HIDDEN) |
| 163 case HIDDEN: | 207 return NULL; |
| 164 return NULL; | 208 |
| 165 case VISIBLE_MINIMIZED: | 209 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 } | 210 } |
| 173 | 211 |
| 174 // MinimizedHomeDragDelegate: | 212 // MinimizedHomeDragDelegate: |
| 175 virtual void OnDragUpCompleted() OVERRIDE { | 213 virtual void OnDragUpCompleted() OVERRIDE { |
| 176 WindowManager::GetInstance()->ToggleOverview(); | 214 WindowManager::GetInstance()->ToggleOverview(); |
| 177 } | 215 } |
| 178 | 216 |
| 179 // WindowManagerObserver: | 217 // WindowManagerObserver: |
| 180 virtual void OnOverviewModeEnter() OVERRIDE { | 218 virtual void OnOverviewModeEnter() OVERRIDE { |
| 181 SetState(VISIBLE_BOTTOM); | 219 SetState(VISIBLE_BOTTOM); |
| 182 } | 220 } |
| 183 | 221 |
| 184 virtual void OnOverviewModeExit() OVERRIDE { | 222 virtual void OnOverviewModeExit() OVERRIDE { |
| 185 SetState(VISIBLE_MINIMIZED); | 223 SetState(VISIBLE_MINIMIZED); |
| 186 } | 224 } |
| 187 | 225 |
| 188 scoped_ptr<AppModelBuilder> model_builder_; | 226 scoped_ptr<AppModelBuilder> model_builder_; |
| 189 | 227 |
| 190 HomeCard::State state_; | 228 HomeCard::State state_; |
| 191 | 229 |
| 192 views::Widget* home_card_widget_; | 230 views::Widget* home_card_widget_; |
| 193 views::Widget* minimized_widget_; | 231 HomeCardView* home_card_view_; |
| 194 AppListViewDelegate* view_delegate_; | 232 scoped_ptr<AppListViewDelegate> view_delegate_; |
| 195 HomeCardLayoutManager* layout_manager_; | 233 HomeCardLayoutManager* layout_manager_; |
| 196 | 234 |
| 197 // Right now HomeCard allows only one search provider. | 235 // Right now HomeCard allows only one search provider. |
| 198 // TODO(mukai): port app-list's SearchController and Mixer. | 236 // TODO(mukai): port app-list's SearchController and Mixer. |
| 199 scoped_ptr<app_list::SearchProvider> search_provider_; | 237 scoped_ptr<app_list::SearchProvider> search_provider_; |
| 200 | 238 |
| 201 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); | 239 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); |
| 202 }; | 240 }; |
| 203 | 241 |
| 204 HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) | 242 HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) |
| 205 : model_builder_(model_builder), | 243 : model_builder_(model_builder), |
| 206 state_(VISIBLE_MINIMIZED), | 244 state_(VISIBLE_MINIMIZED), |
| 207 home_card_widget_(NULL), | 245 home_card_widget_(NULL), |
| 208 minimized_widget_(NULL), | 246 home_card_view_(NULL), |
| 209 layout_manager_(NULL) { | 247 layout_manager_(NULL) { |
| 210 DCHECK(!instance); | 248 DCHECK(!instance); |
| 211 instance = this; | 249 instance = this; |
| 212 WindowManager::GetInstance()->AddObserver(this); | 250 WindowManager::GetInstance()->AddObserver(this); |
| 213 } | 251 } |
| 214 | 252 |
| 215 HomeCardImpl::~HomeCardImpl() { | 253 HomeCardImpl::~HomeCardImpl() { |
| 216 DCHECK(instance); | 254 DCHECK(instance); |
| 217 WindowManager::GetInstance()->RemoveObserver(this); | 255 WindowManager::GetInstance()->RemoveObserver(this); |
| 218 home_card_widget_->CloseNow(); | 256 home_card_widget_->CloseNow(); |
| 219 minimized_widget_->CloseNow(); | |
| 220 view_delegate_ = NULL; | |
| 221 instance = NULL; | 257 instance = NULL; |
| 222 } | 258 } |
| 223 | 259 |
| 224 void HomeCardImpl::SetState(HomeCard::State state) { | 260 void HomeCardImpl::SetState(HomeCard::State state) { |
| 225 // Update |state_| before changing the visibility of the widgets, so that | 261 // Update |state_| before changing the visibility of the widgets, so that |
| 226 // LayoutManager callbacks get the correct state. | 262 // LayoutManager callbacks get the correct state. |
| 227 state_ = state; | 263 state_ = state; |
| 228 switch (state_) { | 264 if (state_ == HIDDEN) { |
| 229 case VISIBLE_MINIMIZED: | 265 home_card_widget_->Hide(); |
| 230 home_card_widget_->Hide(); | 266 } else { |
| 231 minimized_widget_->Show(); | 267 home_card_widget_->Show(); |
| 232 break; | 268 home_card_view_->bottom_view()->SetVisible(state == VISIBLE_BOTTOM); |
|
oshima
2014/07/17 21:47:33
It's probably better to have HomeCardView::SetStat
Jun Mukai
2014/07/17 22:03:43
Done.
| |
| 233 case HIDDEN: | 269 home_card_view_->main_view()->SetVisible(state == VISIBLE_CENTERED); |
| 234 home_card_widget_->Hide(); | 270 home_card_view_->minimized_view()->SetVisible(state == VISIBLE_MINIMIZED); |
| 235 minimized_widget_->Hide(); | 271 if (state == VISIBLE_CENTERED) { |
| 236 break; | 272 app_list::ContentsView* contents_view = |
| 237 case VISIBLE_BOTTOM: | 273 home_card_view_->main_view()->contents_view(); |
| 238 case VISIBLE_CENTERED: | 274 contents_view->SetActivePage(contents_view->GetPageIndexForNamedPage( |
| 239 home_card_widget_->Show(); | 275 app_list::ContentsView::NAMED_PAGE_START)); |
| 240 minimized_widget_->Hide(); | 276 } |
| 241 break; | 277 home_card_view_->Layout(); |
| 278 layout_manager_->Layout(); | |
| 242 } | 279 } |
| 243 } | 280 } |
| 244 | 281 |
| 245 void HomeCardImpl::RegisterSearchProvider( | 282 void HomeCardImpl::RegisterSearchProvider( |
| 246 app_list::SearchProvider* search_provider) { | 283 app_list::SearchProvider* search_provider) { |
| 247 DCHECK(!search_provider_); | 284 DCHECK(!search_provider_); |
| 248 search_provider_.reset(search_provider); | 285 search_provider_.reset(search_provider); |
| 249 view_delegate_->RegisterSearchProvider(search_provider_.get()); | 286 view_delegate_->RegisterSearchProvider(search_provider_.get()); |
| 250 } | 287 } |
| 251 | 288 |
| 252 void HomeCardImpl::UpdateVirtualKeyboardBounds( | 289 void HomeCardImpl::UpdateVirtualKeyboardBounds( |
| 253 const gfx::Rect& bounds) { | 290 const gfx::Rect& bounds) { |
| 254 if (state_ == VISIBLE_MINIMIZED) { | 291 if (state_ == VISIBLE_BOTTOM && !bounds.IsEmpty()) |
| 255 if (bounds.IsEmpty()) | 292 SetState(VISIBLE_CENTERED); |
|
oshima
2014/07/17 21:47:33
don't we have to handle the case where virtual key
sadrul
2014/07/17 22:01:38
Note that when the keyboard pops up for the web-pa
Jun Mukai
2014/07/17 22:03:43
The problem is, we don't know home card appears ce
Jun Mukai
2014/07/17 22:12:56
Done.
| |
| 256 minimized_widget_->Show(); | |
| 257 else | |
| 258 minimized_widget_->Hide(); | |
| 259 } | |
| 260 layout_manager_->UpdateVirtualKeyboardBounds(bounds); | |
| 261 } | 293 } |
| 262 | 294 |
| 263 void HomeCardImpl::Init() { | 295 void HomeCardImpl::Init() { |
| 264 InstallAccelerators(); | 296 InstallAccelerators(); |
| 265 | 297 |
| 266 aura::Window* container = | 298 aura::Window* container = |
| 267 ScreenManager::Get()->CreateContainer("HomeCardContainer"); | 299 ScreenManager::Get()->CreateContainer("HomeCardContainer"); |
| 268 layout_manager_ = new HomeCardLayoutManager(this); | 300 layout_manager_ = new HomeCardLayoutManager(this); |
| 269 container->SetLayoutManager(layout_manager_); | 301 container->SetLayoutManager(layout_manager_); |
| 270 wm::SetChildWindowVisibilityChangesAnimated(container); | 302 wm::SetChildWindowVisibilityChangesAnimated(container); |
| 271 | 303 |
| 272 view_delegate_ = new AppListViewDelegate(model_builder_.get()); | 304 view_delegate_.reset(new AppListViewDelegate(model_builder_.get())); |
| 273 if (search_provider_) | 305 if (search_provider_) |
| 274 view_delegate_->RegisterSearchProvider(search_provider_.get()); | 306 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 | 307 |
| 284 // Start off in the minimized state. | 308 // Force showing in the experimental app-list view. |
| 285 minimized_widget_ = CreateMinimizedHome(container, this); | 309 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 310 app_list::switches::kEnableExperimentalAppList); | |
|
sadrul
2014/07/17 22:01:38
Should this be in athena/main/ instead?
sadrul
2014/07/18 15:32:36
ping
Jun Mukai
2014/07/18 20:27:39
Done.
| |
| 311 | |
| 312 home_card_view_ = new HomeCardView(view_delegate_.get(), container, this); | |
| 313 home_card_widget_ = new views::Widget(); | |
| 314 views::Widget::InitParams params( | |
| 315 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
| 316 params.parent = container; | |
| 317 params.delegate = home_card_view_; | |
| 318 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | |
| 319 home_card_widget_->Init(params); | |
| 320 | |
| 286 SetState(VISIBLE_MINIMIZED); | 321 SetState(VISIBLE_MINIMIZED); |
| 287 } | 322 } |
| 288 | 323 |
| 289 void HomeCardImpl::InstallAccelerators() { | 324 void HomeCardImpl::InstallAccelerators() { |
| 290 const AcceleratorData accelerator_data[] = { | 325 const AcceleratorData accelerator_data[] = { |
| 291 {TRIGGER_ON_PRESS, ui::VKEY_L, ui::EF_CONTROL_DOWN, | 326 {TRIGGER_ON_PRESS, ui::VKEY_L, ui::EF_CONTROL_DOWN, |
| 292 COMMAND_SHOW_HOME_CARD, AF_NONE}, | 327 COMMAND_SHOW_HOME_CARD, AF_NONE}, |
| 293 }; | 328 }; |
| 294 AcceleratorManager::Get()->RegisterAccelerators( | 329 AcceleratorManager::Get()->RegisterAccelerators( |
| 295 accelerator_data, arraysize(accelerator_data), this); | 330 accelerator_data, arraysize(accelerator_data), this); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 311 instance = NULL; | 346 instance = NULL; |
| 312 } | 347 } |
| 313 | 348 |
| 314 // static | 349 // static |
| 315 HomeCard* HomeCard::Get() { | 350 HomeCard* HomeCard::Get() { |
| 316 DCHECK(instance); | 351 DCHECK(instance); |
| 317 return instance; | 352 return instance; |
| 318 } | 353 } |
| 319 | 354 |
| 320 } // namespace athena | 355 } // namespace athena |
| OLD | NEW |