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/launcher_button.h" | 7 #include "ash/launcher/launcher_button.h" |
8 #include "ash/launcher/launcher_delegate.h" | 8 #include "ash/launcher/launcher_delegate.h" |
9 #include "ash/launcher/launcher_icons_observer.h" | |
9 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_window_cycler.h" | 11 #include "ash/launcher/launcher_window_cycler.h" |
11 #include "ash/launcher/tabbed_launcher_button.h" | 12 #include "ash/launcher/tabbed_launcher_button.h" |
12 #include "ash/launcher/view_model.h" | 13 #include "ash/launcher/view_model.h" |
13 #include "ash/launcher/view_model_utils.h" | 14 #include "ash/launcher/view_model_utils.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
15 #include "ash/shell_delegate.h" | 16 #include "ash/shell_delegate.h" |
16 #include "base/auto_reset.h" | 17 #include "base/auto_reset.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 } | 322 } |
322 } | 323 } |
323 | 324 |
324 int LauncherView::DetermineLastVisibleIndex(int max_x) { | 325 int LauncherView::DetermineLastVisibleIndex(int max_x) { |
325 int index = view_model_->view_size() - 1; | 326 int index = view_model_->view_size() - 1; |
326 while (index >= 0 && view_model_->ideal_bounds(index).right() > max_x) | 327 while (index >= 0 && view_model_->ideal_bounds(index).right() > max_x) |
327 index--; | 328 index--; |
328 return index; | 329 return index; |
329 } | 330 } |
330 | 331 |
332 void LauncherView::AddIconsObserver(LauncherIconsObserver* observer) { | |
333 observers_.AddObserver(observer); | |
334 } | |
335 | |
336 void LauncherView::RemoveIconsObserver(LauncherIconsObserver* observer) { | |
337 observers_.RemoveObserver(observer); | |
338 } | |
339 | |
331 void LauncherView::AnimateToIdealBounds() { | 340 void LauncherView::AnimateToIdealBounds() { |
332 IdealBounds ideal_bounds; | 341 IdealBounds ideal_bounds; |
333 CalculateIdealBounds(&ideal_bounds); | 342 CalculateIdealBounds(&ideal_bounds); |
334 for (int i = 0; i < view_model_->view_size(); ++i) { | 343 for (int i = 0; i < view_model_->view_size(); ++i) { |
335 bounds_animator_->AnimateViewTo(view_model_->view_at(i), | 344 bounds_animator_->AnimateViewTo(view_model_->view_at(i), |
336 view_model_->ideal_bounds(i)); | 345 view_model_->ideal_bounds(i)); |
337 } | 346 } |
338 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); | 347 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); |
348 FOR_EACH_OBSERVER(LauncherIconsObserver, observers_, | |
349 OnLauncherIconPositionsChanged()); | |
sky
2012/03/23 20:33:12
What is it you're trying to track?
Dmitry Lomov (no reviews)
2012/03/23 20:36:00
The fact that launcher icons changed their positio
| |
339 } | 350 } |
340 | 351 |
341 views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { | 352 views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { |
342 views::View* view = NULL; | 353 views::View* view = NULL; |
343 switch (item.type) { | 354 switch (item.type) { |
344 case TYPE_TABBED: { | 355 case TYPE_TABBED: { |
345 TabbedLauncherButton* button = | 356 TabbedLauncherButton* button = |
346 TabbedLauncherButton::Create( | 357 TabbedLauncherButton::Create( |
347 this, | 358 this, |
348 this, | 359 this, |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 // code. | 759 // code. |
749 if (launcher_menu_runner_->RunMenuAt( | 760 if (launcher_menu_runner_->RunMenuAt( |
750 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 761 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
751 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 762 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
752 return; | 763 return; |
753 #endif | 764 #endif |
754 } | 765 } |
755 | 766 |
756 } // namespace internal | 767 } // namespace internal |
757 } // namespace ash | 768 } // namespace ash |
OLD | NEW |