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

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 | ash/wm/shelf_layout_manager.cc » ('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/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 10 matching lines...) Expand all
21 #include "grit/ash_strings.h" 21 #include "grit/ash_strings.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 22 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkColor.h" 23 #include "third_party/skia/include/core/SkColor.h"
24 #include "third_party/skia/include/core/SkPaint.h" 24 #include "third_party/skia/include/core/SkPaint.h"
25 #include "third_party/skia/include/core/SkPath.h" 25 #include "third_party/skia/include/core/SkPath.h"
26 #include "ui/aura/root_window.h" 26 #include "ui/aura/root_window.h"
27 #include "ui/base/events.h" 27 #include "ui/base/events.h"
28 #include "ui/base/accessibility/accessible_view_state.h" 28 #include "ui/base/accessibility/accessible_view_state.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
31 #include "ui/gfx/screen.h"
31 #include "ui/gfx/skia_util.h" 32 #include "ui/gfx/skia_util.h"
32 #include "ui/views/border.h" 33 #include "ui/views/border.h"
33 #include "ui/views/bubble/bubble_delegate.h" 34 #include "ui/views/bubble/bubble_delegate.h"
34 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
35 #include "ui/views/layout/fill_layout.h" 36 #include "ui/views/layout/fill_layout.h"
36 #include "ui/views/layout/box_layout.h" 37 #include "ui/views/layout/box_layout.h"
37 #include "ui/views/view.h" 38 #include "ui/views/view.h"
38 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
39 40
40 namespace ash { 41 namespace ash {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 345 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
345 it != items_.end(); 346 it != items_.end();
346 ++it) { 347 ++it) {
347 views::View* view = detailed_ ? (*it)->CreateDetailedView(login_status) : 348 views::View* view = detailed_ ? (*it)->CreateDetailedView(login_status) :
348 (*it)->CreateDefaultView(login_status); 349 (*it)->CreateDefaultView(login_status);
349 if (view) 350 if (view)
350 AddChildView(new TrayPopupItemContainer(view)); 351 AddChildView(new TrayPopupItemContainer(view));
351 } 352 }
352 } 353 }
353 354
355 virtual gfx::Rect GetAnchorRect() OVERRIDE {
356 views::Widget* widget = tray_->GetWidget();
357 if (widget->IsVisible()) {
358 gfx::Rect rect = widget->GetWindowScreenBounds();
359 rect.Inset(0, 0, kPaddingFromRightEdgeOfScreen,
360 kPaddingFromBottomOfScreen);
361 return rect;
362 }
363 gfx::Rect rect = gfx::Screen::GetPrimaryMonitorBounds();
364 return gfx::Rect(rect.width() - kPaddingFromRightEdgeOfScreen,
365 rect.height() - kPaddingFromBottomOfScreen,
366 0, 0);
367 }
368
354 // Overridden from views::View. 369 // Overridden from views::View.
355 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { 370 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE {
356 state->role = ui::AccessibilityTypes::ROLE_WINDOW; 371 state->role = ui::AccessibilityTypes::ROLE_WINDOW;
357 state->name = l10n_util::GetStringUTF16( 372 state->name = l10n_util::GetStringUTF16(
358 IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); 373 IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
359 } 374 }
360 375
361 virtual bool CanActivate() const OVERRIDE { 376 virtual bool CanActivate() const OVERRIDE {
362 return can_activate_; 377 return can_activate_;
363 } 378 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 popup_->Hide(); 675 popup_->Hide();
661 } 676 }
662 } 677 }
663 return base::EVENT_CONTINUE; 678 return base::EVENT_CONTINUE;
664 } 679 }
665 680
666 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { 681 void SystemTray::DidProcessEvent(const base::NativeEvent& event) {
667 } 682 }
668 683
669 } // namespace ash 684 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698