| OLD | NEW |
| 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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | |
| 8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 9 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 10 #include "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
| 11 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
| 12 #include "ui/app_list/app_list_view_delegate.h" | 11 #include "ui/app_list/app_list_view_delegate.h" |
| 13 #include "ui/app_list/pagination_model.h" | 12 #include "ui/app_list/pagination_model.h" |
| 14 #include "ui/app_list/signin_delegate.h" | 13 #include "ui/app_list/signin_delegate.h" |
| 15 #include "ui/app_list/views/app_list_background.h" | 14 #include "ui/app_list/views/app_list_background.h" |
| 16 #include "ui/app_list/views/app_list_main_view.h" | 15 #include "ui/app_list/views/app_list_main_view.h" |
| 17 #include "ui/app_list/views/search_box_view.h" | 16 #include "ui/app_list/views/search_box_view.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 #include "ui/aura/root_window.h" | 30 #include "ui/aura/root_window.h" |
| 32 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 33 #include "ui/base/win/shell.h" | 32 #include "ui/base/win/shell.h" |
| 34 #endif | 33 #endif |
| 35 #endif | 34 #endif |
| 36 | 35 |
| 37 namespace app_list { | 36 namespace app_list { |
| 38 | 37 |
| 39 namespace { | 38 namespace { |
| 40 | 39 |
| 41 base::Closure g_next_paint_callback; | 40 void (*g_next_paint_callback)(); |
| 42 | 41 |
| 43 // The distance between the arrow tip and edge of the anchor view. | 42 // The distance between the arrow tip and edge of the anchor view. |
| 44 const int kArrowOffset = 10; | 43 const int kArrowOffset = 10; |
| 45 | 44 |
| 46 } // namespace | 45 } // namespace |
| 47 | 46 |
| 48 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
| 49 // AppListView: | 48 // AppListView: |
| 50 | 49 |
| 51 AppListView::AppListView(AppListViewDelegate* delegate) | 50 AppListView::AppListView(AppListViewDelegate* delegate) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void AppListView::UpdateBounds() { | 118 void AppListView::UpdateBounds() { |
| 120 SizeToContents(); | 119 SizeToContents(); |
| 121 } | 120 } |
| 122 | 121 |
| 123 gfx::Size AppListView::GetPreferredSize() { | 122 gfx::Size AppListView::GetPreferredSize() { |
| 124 return app_list_main_view_->GetPreferredSize(); | 123 return app_list_main_view_->GetPreferredSize(); |
| 125 } | 124 } |
| 126 | 125 |
| 127 void AppListView::Paint(gfx::Canvas* canvas) { | 126 void AppListView::Paint(gfx::Canvas* canvas) { |
| 128 views::BubbleDelegateView::Paint(canvas); | 127 views::BubbleDelegateView::Paint(canvas); |
| 129 if (!g_next_paint_callback.is_null()) { | 128 if (g_next_paint_callback) { |
| 130 g_next_paint_callback.Run(); | 129 g_next_paint_callback(); |
| 131 g_next_paint_callback.Reset(); | 130 g_next_paint_callback = NULL; |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 | 133 |
| 135 bool AppListView::ShouldHandleSystemCommands() const { | 134 bool AppListView::ShouldHandleSystemCommands() const { |
| 136 return true; | 135 return true; |
| 137 } | 136 } |
| 138 | 137 |
| 139 void AppListView::Prerender() { | 138 void AppListView::Prerender() { |
| 140 app_list_main_view_->Prerender(); | 139 app_list_main_view_->Prerender(); |
| 141 } | 140 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 152 | 151 |
| 153 void AppListView::AddObserver(Observer* observer) { | 152 void AppListView::AddObserver(Observer* observer) { |
| 154 observers_.AddObserver(observer); | 153 observers_.AddObserver(observer); |
| 155 } | 154 } |
| 156 | 155 |
| 157 void AppListView::RemoveObserver(Observer* observer) { | 156 void AppListView::RemoveObserver(Observer* observer) { |
| 158 observers_.RemoveObserver(observer); | 157 observers_.RemoveObserver(observer); |
| 159 } | 158 } |
| 160 | 159 |
| 161 // static | 160 // static |
| 162 void AppListView::SetNextPaintCallback(const base::Closure& callback) { | 161 void AppListView::SetNextPaintCallback(void (*callback)()) { |
| 163 g_next_paint_callback = callback; | 162 g_next_paint_callback = callback; |
| 164 } | 163 } |
| 165 | 164 |
| 166 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
| 167 HWND AppListView::GetHWND() const { | 166 HWND AppListView::GetHWND() const { |
| 168 #if defined(USE_AURA) | 167 #if defined(USE_AURA) |
| 169 gfx::NativeWindow window = | 168 gfx::NativeWindow window = |
| 170 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); | 169 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); |
| 171 return window->GetDispatcher()->GetAcceleratedWidget(); | 170 return window->GetDispatcher()->GetAcceleratedWidget(); |
| 172 #else | 171 #else |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 315 |
| 317 void AppListView::OnAppListModelSigninStatusChanged() { | 316 void AppListView::OnAppListModelSigninStatusChanged() { |
| 318 OnSigninStatusChanged(); | 317 OnSigninStatusChanged(); |
| 319 } | 318 } |
| 320 | 319 |
| 321 void AppListView::OnAppListModelUsersChanged() { | 320 void AppListView::OnAppListModelUsersChanged() { |
| 322 OnSigninStatusChanged(); | 321 OnSigninStatusChanged(); |
| 323 } | 322 } |
| 324 | 323 |
| 325 } // namespace app_list | 324 } // namespace app_list |
| OLD | NEW |