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

Side by Side Diff: ash/shelf/alternate_app_list_button.cc

Issue 23928004: ash:Shelf - Update position and hit box of status area. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed duplicate variable Created 7 years, 3 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 | « no previous file | ash/shelf/overflow_button.cc » ('j') | ash/system/tray/tray_background_view.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/alternate_app_list_button.h" 5 #include "ash/shelf/alternate_app_list_button.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/launcher/launcher_button_host.h" 8 #include "ash/launcher/launcher_button_host.h"
9 #include "ash/launcher/launcher_types.h" 9 #include "ash/launcher/launcher_types.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "grit/ash_resources.h" 13 #include "grit/ash_resources.h"
14 #include "grit/ash_strings.h" 14 #include "grit/ash_strings.h"
15 #include "ui/base/accessibility/accessible_view_state.h" 15 #include "ui/base/accessibility/accessible_view_state.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/compositor/layer.h" 18 #include "ui/compositor/layer.h"
19 #include "ui/compositor/layer_animation_element.h" 19 #include "ui/compositor/layer_animation_element.h"
20 #include "ui/compositor/layer_animation_sequence.h" 20 #include "ui/compositor/layer_animation_sequence.h"
21 #include "ui/compositor/scoped_layer_animation_settings.h" 21 #include "ui/compositor/scoped_layer_animation_settings.h"
22 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/image/image_skia_operations.h" 23 #include "ui/gfx/image/image_skia_operations.h"
24 #include "ui/views/controls/button/image_button.h" 24 #include "ui/views/controls/button/image_button.h"
25 25
26 namespace ash { 26 namespace ash {
27 namespace internal { 27 namespace internal {
28 namespace {
29 const int kImagePaddingFromShelf = 5;
30 } // namespace
31 28
32 // static 29 // static
33 const int AlternateAppListButton::kImageBoundsSize = 7; 30 const int AlternateAppListButton::kImageBoundsSize = 7;
34 31
35 32
36 AlternateAppListButton::AlternateAppListButton(views::ButtonListener* listener, 33 AlternateAppListButton::AlternateAppListButton(views::ButtonListener* listener,
37 LauncherButtonHost* host, 34 LauncherButtonHost* host,
38 ShelfWidget* shelf_widget) 35 ShelfWidget* shelf_widget)
39 : views::ImageButton(listener), 36 : views::ImageButton(listener),
40 host_(host), 37 host_(host),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const gfx::ImageSkia* forground_image = 100 const gfx::ImageSkia* forground_image =
104 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_ALTERNATE).ToImageSkia(); 101 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_ALTERNATE).ToImageSkia();
105 102
106 gfx::Rect contents_bounds = GetContentsBounds(); 103 gfx::Rect contents_bounds = GetContentsBounds();
107 gfx::Rect background_bounds, forground_bounds; 104 gfx::Rect background_bounds, forground_bounds;
108 105
109 ShelfAlignment alignment = shelf_widget_->GetAlignment(); 106 ShelfAlignment alignment = shelf_widget_->GetAlignment();
110 background_bounds.set_size(background_image->size()); 107 background_bounds.set_size(background_image->size());
111 if (alignment == SHELF_ALIGNMENT_LEFT) { 108 if (alignment == SHELF_ALIGNMENT_LEFT) {
112 background_bounds.set_x(contents_bounds.width() - 109 background_bounds.set_x(contents_bounds.width() -
113 kImagePaddingFromShelf - background_image->width()); 110 ShelfLayoutManager::kShelfItemInset - background_image->width());
Mr4D (OOO till 08-26) 2013/09/18 00:07:49 Apparently the old value was 5 and this is 3 - I g
Harry McCleave 2013/09/18 01:34:56 Yes, this is intended to keep all items aligned.
114 background_bounds.set_y(contents_bounds.y() + 111 background_bounds.set_y(contents_bounds.y() +
115 (contents_bounds.height() - background_image->height()) / 2); 112 (contents_bounds.height() - background_image->height()) / 2);
116 } else if(alignment == SHELF_ALIGNMENT_RIGHT) { 113 } else if(alignment == SHELF_ALIGNMENT_RIGHT) {
117 background_bounds.set_x(kImagePaddingFromShelf); 114 background_bounds.set_x(ShelfLayoutManager::kShelfItemInset);
118 background_bounds.set_y(contents_bounds.y() + 115 background_bounds.set_y(contents_bounds.y() +
119 (contents_bounds.height() - background_image->height()) / 2); 116 (contents_bounds.height() - background_image->height()) / 2);
120 } else { 117 } else {
121 background_bounds.set_y(kImagePaddingFromShelf); 118 background_bounds.set_y(ShelfLayoutManager::kShelfItemInset);
122 background_bounds.set_x(contents_bounds.x() + 119 background_bounds.set_x(contents_bounds.x() +
123 (contents_bounds.width() - background_image->width()) / 2); 120 (contents_bounds.width() - background_image->width()) / 2);
124 } 121 }
125 122
126 forground_bounds.set_size(forground_image->size()); 123 forground_bounds.set_size(forground_image->size());
127 forground_bounds.set_x(background_bounds.x() + 124 forground_bounds.set_x(background_bounds.x() +
128 std::max(0, 125 std::max(0,
129 (background_bounds.width() - forground_bounds.width()) / 2)); 126 (background_bounds.width() - forground_bounds.width()) / 2));
130 forground_bounds.set_y(background_bounds.y() + 127 forground_bounds.set_y(background_bounds.y() +
131 std::max(0, 128 std::max(0,
(...skipping 10 matching lines...) Expand all
142 } 139 }
143 140
144 void AlternateAppListButton::GetAccessibleState( 141 void AlternateAppListButton::GetAccessibleState(
145 ui::AccessibleViewState* state) { 142 ui::AccessibleViewState* state) {
146 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; 143 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
147 state->name = host_->GetAccessibleName(this); 144 state->name = host_->GetAccessibleName(this);
148 } 145 }
149 146
150 } // namespace internal 147 } // namespace internal
151 } // namespace ash 148 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/overflow_button.cc » ('j') | ash/system/tray/tray_background_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698