OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include "ash/launcher/app_launcher_button.h" | 7 #include "ash/launcher/app_launcher_button.h" |
8 #include "ash/launcher/launcher_delegate.h" | 8 #include "ash/launcher/launcher_delegate.h" |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_window_cycler.h" | 10 #include "ash/launcher/launcher_window_cycler.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 view_model_->ideal_bounds(i)); | 296 view_model_->ideal_bounds(i)); |
297 } | 297 } |
298 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); | 298 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); |
299 } | 299 } |
300 | 300 |
301 views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { | 301 views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { |
302 views::View* view = NULL; | 302 views::View* view = NULL; |
303 switch (item.type) { | 303 switch (item.type) { |
304 case TYPE_TABBED: { | 304 case TYPE_TABBED: { |
305 TabbedLauncherButton* button = new TabbedLauncherButton(this, this); | 305 TabbedLauncherButton* button = new TabbedLauncherButton(this, this); |
306 button->SetTabImage(item.image, item.num_tabs); | 306 button->SetTabImage(item.image, item.num_tabs, item.private_tab); |
oshima
2012/03/09 17:54:02
maybe pass LauncherItem? It doesn't sound odd for
Zachary Kuznia
2012/03/09 22:17:35
Done.
| |
307 button->set_context_menu_controller(this); | 307 button->set_context_menu_controller(this); |
308 view = button; | 308 view = button; |
309 break; | 309 break; |
310 } | 310 } |
311 | 311 |
312 case TYPE_APP: { | 312 case TYPE_APP: { |
313 AppLauncherButton* button = new AppLauncherButton(this, this); | 313 AppLauncherButton* button = new AppLauncherButton(this, this); |
314 button->SetAppImage(item.image); | 314 button->SetAppImage(item.image); |
315 view = button; | 315 view = button; |
316 button->set_context_menu_controller(this); | 316 button->set_context_menu_controller(this); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 view_model_->Add(new_view, model_index); | 544 view_model_->Add(new_view, model_index); |
545 new_view->SetBoundsRect(old_view->bounds()); | 545 new_view->SetBoundsRect(old_view->bounds()); |
546 return; | 546 return; |
547 } | 547 } |
548 | 548 |
549 views::View* view = view_model_->view_at(model_index); | 549 views::View* view = view_model_->view_at(model_index); |
550 switch (item.type) { | 550 switch (item.type) { |
551 case TYPE_TABBED: { | 551 case TYPE_TABBED: { |
552 TabbedLauncherButton* button = static_cast<TabbedLauncherButton*>(view); | 552 TabbedLauncherButton* button = static_cast<TabbedLauncherButton*>(view); |
553 gfx::Size pref = button->GetPreferredSize(); | 553 gfx::Size pref = button->GetPreferredSize(); |
554 button->SetTabImage(item.image, item.num_tabs); | 554 button->SetTabImage(item.image, item.num_tabs, item.private_tab); |
555 if (pref != button->GetPreferredSize()) | 555 if (pref != button->GetPreferredSize()) |
556 AnimateToIdealBounds(); | 556 AnimateToIdealBounds(); |
557 else | 557 else |
558 button->SchedulePaint(); | 558 button->SchedulePaint(); |
559 break; | 559 break; |
560 } | 560 } |
561 | 561 |
562 case TYPE_APP: { | 562 case TYPE_APP: { |
563 AppLauncherButton* button = static_cast<AppLauncherButton*>(view); | 563 AppLauncherButton* button = static_cast<AppLauncherButton*>(view); |
564 button->SetAppImage(item.image); | 564 button->SetAppImage(item.image); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 // code. | 693 // code. |
694 if (launcher_menu_runner_->RunMenuAt( | 694 if (launcher_menu_runner_->RunMenuAt( |
695 source->GetWidget(), NULL, gfx::Rect(p, gfx::Size()), | 695 source->GetWidget(), NULL, gfx::Rect(p, gfx::Size()), |
696 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 696 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
697 return; | 697 return; |
698 #endif | 698 #endif |
699 } | 699 } |
700 | 700 |
701 } // namespace internal | 701 } // namespace internal |
702 } // namespace ash | 702 } // namespace ash |
OLD | NEW |