OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
6 | 6 |
7 #include "ash/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "chrome/browser/chromeos/arc/arc_util.h" | 10 #include "chrome/browser/chromeos/arc/arc_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 12 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
13 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_item_controll
er.h" | 13 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_item_controll
er.h" |
14 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 14 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
16 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
17 #include "ui/gfx/image/canvas_image_source.h" | 17 #include "ui/gfx/image/canvas_image_source.h" |
18 #include "ui/gfx/image/image_skia_operations.h" | 18 #include "ui/gfx/image/image_skia_operations.h" |
19 #include "ui/gfx/paint_throbber.h" | 19 #include "ui/gfx/paint_throbber.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 constexpr int kUpdateIconIntervalMs = 40; // 40ms for 25 frames per second. | 23 constexpr int kUpdateIconIntervalMs = 40; // 40ms for 25 frames per second. |
24 constexpr int kSpinningGapPercent = 25; | 24 constexpr int kSpinningGapPercent = 25; |
25 | 25 |
(...skipping 27 matching lines...) Expand all Loading... |
53 private: | 53 private: |
54 base::WeakPtr<ArcAppDeferredLauncherController> host_; | 54 base::WeakPtr<ArcAppDeferredLauncherController> host_; |
55 const std::string shelf_app_id_; | 55 const std::string shelf_app_id_; |
56 const gfx::ImageSkia image_; | 56 const gfx::ImageSkia image_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(SpinningEffectSource); | 58 DISALLOW_COPY_AND_ASSIGN(SpinningEffectSource); |
59 }; | 59 }; |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 ArcAppDeferredLauncherController::ArcAppDeferredLauncherController( | 62 ArcAppDeferredLauncherController::ArcAppDeferredLauncherController( |
63 ChromeLauncherControllerImpl* owner) | 63 ChromeLauncherController* owner) |
64 : owner_(owner), weak_ptr_factory_(this) { | 64 : owner_(owner), weak_ptr_factory_(this) { |
65 if (arc::IsArcAllowedForProfile(owner->profile())) { | 65 if (arc::IsArcAllowedForProfile(owner->profile())) { |
66 observed_profile_ = owner->profile(); | 66 observed_profile_ = owner->profile(); |
67 ArcAppListPrefs::Get(observed_profile_)->AddObserver(this); | 67 ArcAppListPrefs::Get(observed_profile_)->AddObserver(this); |
68 } | 68 } |
69 arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); | 69 arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); |
70 // arc::ArcSessionManager might not be set in tests. | 70 // arc::ArcSessionManager might not be set in tests. |
71 if (arc_session_manager) | 71 if (arc_session_manager) |
72 arc_session_manager->AddObserver(this); | 72 arc_session_manager->AddObserver(this); |
73 } | 73 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, | 214 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, |
215 std::move(controller)); | 215 std::move(controller)); |
216 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 216 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
217 } | 217 } |
218 | 218 |
219 if (app_controller_map_.empty()) | 219 if (app_controller_map_.empty()) |
220 RegisterNextUpdate(); | 220 RegisterNextUpdate(); |
221 | 221 |
222 app_controller_map_[shelf_app_id] = item_controller; | 222 app_controller_map_[shelf_app_id] = item_controller; |
223 } | 223 } |
OLD | NEW |