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

Side by Side Diff: ash/shelf/overflow_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: maybe 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 | « ash/shelf/alternate_app_list_button.cc ('k') | ash/shelf/shelf_layout_manager.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 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/overflow_button.h" 5 #include "ash/shelf/overflow_button.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
10 #include "grit/ash_resources.h" 10 #include "grit/ash_resources.h"
(...skipping 16 matching lines...) Expand all
27 namespace { 27 namespace {
28 28
29 const int kButtonHoverAlpha = 150; 29 const int kButtonHoverAlpha = 150;
30 30
31 const int kButtonCornerRadius = 2; 31 const int kButtonCornerRadius = 2;
32 32
33 const int kButtonHoverSize = 28; 33 const int kButtonHoverSize = 28;
34 34
35 const int kBackgroundOffset = (48 - kButtonHoverSize) / 2; 35 const int kBackgroundOffset = (48 - kButtonHoverSize) / 2;
36 36
37 // Padding from the inner edge of the shelf (towards center of display) to
38 // the edge of the background image of the overflow button.
39 const int kImagePaddingFromShelf = 5;
40
41 } // namesapce 37 } // namesapce
42 38
43 OverflowButton::OverflowButton(views::ButtonListener* listener) 39 OverflowButton::OverflowButton(views::ButtonListener* listener)
44 : CustomButton(listener), 40 : CustomButton(listener),
45 bottom_image_(NULL) { 41 bottom_image_(NULL) {
46 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 42 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
47 bottom_image_ = rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia(); 43 bottom_image_ = rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia();
48 44
49 45
50 set_accessibility_focusable(true); 46 set_accessibility_focusable(true);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; 97 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED;
102 else if(layout_manager->shelf_widget()->GetDimsShelf()) 98 else if(layout_manager->shelf_widget()->GetDimsShelf())
103 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; 99 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK;
104 else 100 else
105 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; 101 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL;
106 102
107 const gfx::ImageSkia* background = 103 const gfx::ImageSkia* background =
108 rb.GetImageNamed(background_image_id).ToImageSkia(); 104 rb.GetImageNamed(background_image_id).ToImageSkia();
109 if (alignment == SHELF_ALIGNMENT_LEFT) { 105 if (alignment == SHELF_ALIGNMENT_LEFT) {
110 bounds = gfx::Rect( 106 bounds = gfx::Rect(
111 bounds.right() - background->width() - kImagePaddingFromShelf, 107 bounds.right() - background->width() -
108 ShelfLayoutManager::kShelfItemInset,
112 bounds.y() + (bounds.height() - background->height()) / 2, 109 bounds.y() + (bounds.height() - background->height()) / 2,
113 background->width(), background->height()); 110 background->width(), background->height());
114 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { 111 } else if (alignment == SHELF_ALIGNMENT_RIGHT) {
115 bounds = gfx::Rect( 112 bounds = gfx::Rect(
116 bounds.x() + kImagePaddingFromShelf, 113 bounds.x() + ShelfLayoutManager::kShelfItemInset,
117 bounds.y() + (bounds.height() - background->height()) / 2, 114 bounds.y() + (bounds.height() - background->height()) / 2,
118 background->width(), background->height()); 115 background->width(), background->height());
119 } else { 116 } else {
120 bounds = gfx::Rect( 117 bounds = gfx::Rect(
121 bounds.x() + (bounds.width() - background->width()) / 2, 118 bounds.x() + (bounds.width() - background->width()) / 2,
122 bounds.y() + kImagePaddingFromShelf, 119 bounds.y() + ShelfLayoutManager::kShelfItemInset,
123 background->width(), background->height()); 120 background->width(), background->height());
124 } 121 }
125 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); 122 canvas->DrawImageInt(*background, bounds.x(), bounds.y());
126 } else { 123 } else {
127 if (alignment == SHELF_ALIGNMENT_BOTTOM) { 124 if (alignment == SHELF_ALIGNMENT_BOTTOM) {
128 bounds = gfx::Rect( 125 bounds = gfx::Rect(
129 bounds.x() + ((bounds.width() - kButtonHoverSize) / 2) - 1, 126 bounds.x() + ((bounds.width() - kButtonHoverSize) / 2) - 1,
130 bounds.y() + kBackgroundOffset - 1, 127 bounds.y() + kBackgroundOffset - 1,
131 kButtonHoverSize, kButtonHoverSize); 128 kButtonHoverSize, kButtonHoverSize);
132 } else { 129 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 break; 166 break;
170 } 167 }
171 168
172 canvas->DrawImageInt(*image, 169 canvas->DrawImageInt(*image,
173 bounds.x() + ((bounds.width() - image->width()) / 2), 170 bounds.x() + ((bounds.width() - image->width()) / 2),
174 bounds.y() + ((bounds.height() - image->height()) / 2)); 171 bounds.y() + ((bounds.height() - image->height()) / 2));
175 } 172 }
176 173
177 } // namespace internal 174 } // namespace internal
178 } // namespace ash 175 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/alternate_app_list_button.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698