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

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 10828184: ash: Update launcher overflow chevron. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix launcher_view_test_api compile Created 8 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 | « ash/launcher/launcher_view.h ('k') | ash/launcher/overflow_button.h » ('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 (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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/launcher/app_list_button.h" 9 #include "ash/launcher/app_list_button.h"
10 #include "ash/launcher/launcher_button.h" 10 #include "ash/launcher/launcher_button.h"
11 #include "ash/launcher/launcher_delegate.h" 11 #include "ash/launcher/launcher_delegate.h"
12 #include "ash/launcher/launcher_icon_observer.h" 12 #include "ash/launcher/launcher_icon_observer.h"
13 #include "ash/launcher/launcher_model.h" 13 #include "ash/launcher/launcher_model.h"
14 #include "ash/launcher/launcher_tooltip_manager.h" 14 #include "ash/launcher/launcher_tooltip_manager.h"
15 #include "ash/launcher/overflow_bubble.h" 15 #include "ash/launcher/overflow_bubble.h"
16 #include "ash/launcher/overflow_button.h"
16 #include "ash/launcher/tabbed_launcher_button.h" 17 #include "ash/launcher/tabbed_launcher_button.h"
17 #include "ash/shell.h" 18 #include "ash/shell.h"
18 #include "ash/shell_delegate.h" 19 #include "ash/shell_delegate.h"
19 #include "base/auto_reset.h" 20 #include "base/auto_reset.h"
20 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
21 #include "grit/ash_strings.h" 22 #include "grit/ash_strings.h"
22 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
23 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
24 #include "ui/base/animation/animation.h" 25 #include "ui/base/animation/animation.h"
25 #include "ui/base/animation/throb_animation.h" 26 #include "ui/base/animation/throb_animation.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 tooltip_.reset(new LauncherTooltipManager( 287 tooltip_.reset(new LauncherTooltipManager(
287 alignment_, shelf_layout_manager, this)); 288 alignment_, shelf_layout_manager, this));
288 } 289 }
289 290
290 LauncherView::~LauncherView() { 291 LauncherView::~LauncherView() {
291 bounds_animator_->RemoveObserver(this); 292 bounds_animator_->RemoveObserver(this);
292 model_->RemoveObserver(this); 293 model_->RemoveObserver(this);
293 } 294 }
294 295
295 void LauncherView::Init() { 296 void LauncherView::Init() {
296 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
297 model_->AddObserver(this); 297 model_->AddObserver(this);
298 298
299 const LauncherItems& items(model_->items()); 299 const LauncherItems& items(model_->items());
300 for (LauncherItems::const_iterator i = items.begin(); i != items.end(); ++i) { 300 for (LauncherItems::const_iterator i = items.begin(); i != items.end(); ++i) {
301 views::View* child = CreateViewForItem(*i); 301 views::View* child = CreateViewForItem(*i);
302 child->SetPaintToLayer(true); 302 child->SetPaintToLayer(true);
303 view_model_->Add(child, static_cast<int>(i - items.begin())); 303 view_model_->Add(child, static_cast<int>(i - items.begin()));
304 AddChildView(child); 304 AddChildView(child);
305 } 305 }
306 UpdateFirstButtonPadding(); 306 UpdateFirstButtonPadding();
307 307
308 overflow_button_ = new views::ImageButton(this); 308 overflow_button_ = new OverflowButton(this);
309 overflow_button_->set_accessibility_focusable(true);
310 overflow_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
311 views::ImageButton::ALIGN_MIDDLE);
312 overflow_button_->SetImage(
313 views::CustomButton::BS_NORMAL,
314 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia());
315 overflow_button_->SetImage(
316 views::CustomButton::BS_HOT,
317 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToImageSkia());
318 overflow_button_->SetImage(
319 views::CustomButton::BS_PUSHED,
320 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToImageSkia());
321 overflow_button_->SetAccessibleName(
322 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME));
323 overflow_button_->set_context_menu_controller(this); 309 overflow_button_->set_context_menu_controller(this);
324 ConfigureChildView(overflow_button_); 310 ConfigureChildView(overflow_button_);
325 AddChildView(overflow_button_); 311 AddChildView(overflow_button_);
326 312
327 // We'll layout when our bounds change. 313 // We'll layout when our bounds change.
328 } 314 }
329 315
330 void LauncherView::SetAlignment(ShelfAlignment alignment) { 316 void LauncherView::SetAlignment(ShelfAlignment alignment) {
331 if (alignment_ == alignment) 317 if (alignment_ == alignment)
332 return; 318 return;
333 alignment_ = alignment; 319 alignment_ = alignment;
334 UpdateFirstButtonPadding(); 320 UpdateFirstButtonPadding();
321 overflow_button_->SetShelfAlignment(alignment_);
335 LayoutToIdealBounds(); 322 LayoutToIdealBounds();
336 tooltip_->SetArrowLocation(alignment_); 323 tooltip_->SetArrowLocation(alignment_);
337 if (overflow_bubble_.get()) 324 if (overflow_bubble_.get())
338 overflow_bubble_->Hide(); 325 overflow_bubble_->Hide();
339 } 326 }
340 327
341 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) { 328 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
342 int index = model_->ItemIndexByID(id); 329 int index = model_->ItemIndexByID(id);
343 if (index == -1 || index > last_visible_index_) 330 if (index == -1 || index > last_visible_index_)
344 return gfx::Rect(); 331 return gfx::Rect();
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1081 FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
1095 OnLauncherIconPositionsChanged()); 1082 OnLauncherIconPositionsChanged());
1096 PreferredSizeChanged(); 1083 PreferredSizeChanged();
1097 } 1084 }
1098 1085
1099 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 1086 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
1100 } 1087 }
1101 1088
1102 } // namespace internal 1089 } // namespace internal
1103 } // namespace ash 1090 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/overflow_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698