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

Side by Side Diff: ash/system/tray/system_tray.cc

Issue 10027007: ash: Make sure the uber-tray popup is positioned correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | no next file » | 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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Draw a line first. 214 // Draw a line first.
215 int y = owner_->height() + 1; 215 int y = owner_->height() + 1;
216 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(), 216 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(),
217 kBottomLineHeight), kBorderDarkColor); 217 kBottomLineHeight), kBorderDarkColor);
218 218
219 // Now, draw a shadow. 219 // Now, draw a shadow.
220 canvas->FillRect(gfx::Rect(kLeftPadding + kShadowOffset, y, 220 canvas->FillRect(gfx::Rect(kLeftPadding + kShadowOffset, y,
221 owner_->width() - kShadowOffset, kShadowHeight), 221 owner_->width() - kShadowOffset, kShadowHeight),
222 kShadowColor); 222 kShadowColor);
223 223
224 if (Shell::GetInstance()->shelf()->IsVisible()) { 224 Shell* shell = Shell::GetInstance();
225 if (shell->shelf()->IsVisible() &&
226 !shell->tray()->GetWidget()->GetWindowScreenBounds().IsEmpty()) {
sadrul 2012/04/09 00:08:37 Should 'IsVisible' check whether it has non-empty
sky 2012/04/09 15:11:21 Yes, I think that's a good idea.
sadrul 2012/04/09 20:56:28 Done.
225 // Draw the arrow. 227 // Draw the arrow.
226 int left_base_x = owner_->width() - kArrowPaddingFromRight - kArrowWidth; 228 int left_base_x = owner_->width() - kArrowPaddingFromRight - kArrowWidth;
227 int left_base_y = y; 229 int left_base_y = y;
228 int tip_x = left_base_x + kArrowWidth / 2; 230 int tip_x = left_base_x + kArrowWidth / 2;
229 int tip_y = left_base_y + kArrowHeight; 231 int tip_y = left_base_y + kArrowHeight;
230 SkPath path; 232 SkPath path;
231 path.incReserve(4); 233 path.incReserve(4);
232 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y)); 234 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y));
233 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); 235 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y));
234 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), 236 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 346 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
345 it != items_.end(); 347 it != items_.end();
346 ++it) { 348 ++it) {
347 views::View* view = detailed_ ? (*it)->CreateDetailedView(login_status) : 349 views::View* view = detailed_ ? (*it)->CreateDetailedView(login_status) :
348 (*it)->CreateDefaultView(login_status); 350 (*it)->CreateDefaultView(login_status);
349 if (view) 351 if (view)
350 AddChildView(new TrayPopupItemContainer(view)); 352 AddChildView(new TrayPopupItemContainer(view));
351 } 353 }
352 } 354 }
353 355
356 virtual gfx::Rect GetAnchorRect() OVERRIDE {
357 gfx::Rect rect = tray_->GetWidget()->GetWindowScreenBounds();
358 rect.Inset(0, 0, kPaddingFromRightEdgeOfScreen, 0);
359 return rect;
360 }
361
354 // Overridden from views::View. 362 // Overridden from views::View.
355 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { 363 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE {
356 state->role = ui::AccessibilityTypes::ROLE_WINDOW; 364 state->role = ui::AccessibilityTypes::ROLE_WINDOW;
357 state->name = l10n_util::GetStringUTF16( 365 state->name = l10n_util::GetStringUTF16(
358 IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); 366 IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
359 } 367 }
360 368
361 virtual bool CanActivate() const OVERRIDE { 369 virtual bool CanActivate() const OVERRIDE {
362 return can_activate_; 370 return can_activate_;
363 } 371 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 popup_->Hide(); 668 popup_->Hide();
661 } 669 }
662 } 670 }
663 return base::EVENT_CONTINUE; 671 return base::EVENT_CONTINUE;
664 } 672 }
665 673
666 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { 674 void SystemTray::DidProcessEvent(const base::NativeEvent& event) {
667 } 675 }
668 676
669 } // namespace ash 677 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698