Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/first_run/first_run_helper_impl.h" | 5 #include "ash/first_run/first_run_helper_impl.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/app_list_button.h" | 7 #include "ash/common/shelf/app_list_button.h" |
| 8 #include "ash/common/shelf/shelf.h" | 8 #include "ash/common/shelf/shelf_widget.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | |
| 9 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
| 12 #include "ash/common/wm_lookup.h" | |
| 11 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "ui/app_list/views/app_list_view.h" | 15 #include "ui/app_list/views/app_list_view.h" |
| 14 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 15 #include "ui/display/display.h" | 17 #include "ui/display/display.h" |
| 16 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
| 19 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 20 | 22 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 46 if (IsTrayBubbleOpened()) | 48 if (IsTrayBubbleOpened()) |
| 47 CloseTrayBubble(); | 49 CloseTrayBubble(); |
| 48 widget_->Close(); | 50 widget_->Close(); |
| 49 } | 51 } |
| 50 | 52 |
| 51 views::Widget* FirstRunHelperImpl::GetOverlayWidget() { | 53 views::Widget* FirstRunHelperImpl::GetOverlayWidget() { |
| 52 return widget_; | 54 return widget_; |
| 53 } | 55 } |
| 54 | 56 |
| 55 gfx::Rect FirstRunHelperImpl::GetAppListButtonBounds() { | 57 gfx::Rect FirstRunHelperImpl::GetAppListButtonBounds() { |
| 56 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 58 WmShelf* shelf = |
| 57 AppListButton* app_button = shelf->GetAppListButton(); | 59 WmShelf::ForWindow(WmLookup::Get()->GetWindowForWidget(widget_)); |
|
msw
2016/08/29 22:58:08
nit/q: Why look up widget_ instead of using WmShel
James Cook
2016/08/29 23:49:25
No particularly good reason. Switched to WmShell::
| |
| 60 AppListButton* app_button = shelf->shelf_widget()->GetAppListButton(); | |
| 58 return app_button->GetBoundsInScreen(); | 61 return app_button->GetBoundsInScreen(); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void FirstRunHelperImpl::Cancel() { | 64 void FirstRunHelperImpl::Cancel() { |
| 62 FOR_EACH_OBSERVER(Observer, observers(), OnCancelled()); | 65 FOR_EACH_OBSERVER(Observer, observers(), OnCancelled()); |
| 63 } | 66 } |
| 64 | 67 |
| 65 bool FirstRunHelperImpl::IsCancelingKeyEvent(ui::KeyEvent* event) { | 68 bool FirstRunHelperImpl::IsCancelingKeyEvent(ui::KeyEvent* event) { |
| 66 return event->key_code() == ui::VKEY_ESCAPE; | 69 return event->key_code() == ui::VKEY_ESCAPE; |
| 67 } | 70 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 92 return bubble->GetBoundsInScreen(); | 95 return bubble->GetBoundsInScreen(); |
| 93 } | 96 } |
| 94 | 97 |
| 95 gfx::Rect FirstRunHelperImpl::GetHelpButtonBounds() { | 98 gfx::Rect FirstRunHelperImpl::GetHelpButtonBounds() { |
| 96 SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); | 99 SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); |
| 97 views::View* help_button = tray->GetHelpButtonView(); | 100 views::View* help_button = tray->GetHelpButtonView(); |
| 98 return help_button->GetBoundsInScreen(); | 101 return help_button->GetBoundsInScreen(); |
| 99 } | 102 } |
| 100 | 103 |
| 101 } // namespace ash | 104 } // namespace ash |
| OLD | NEW |