Chromium Code Reviews

Side by Side Diff: components/arc/test/fake_arc_bridge_service.h

Issue 1413153007: arc-app-launcher: Minimal support for ARC app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit comments addressed Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER _H_
Luis Héctor Chávez 2015/11/18 18:22:19 COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H
khmel1 2015/11/19 02:56:13 Done.
6 #define CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER _H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "components/arc/arc_bridge_service.h"
13 #include "ui/base/layout.h"
14
15 class FakeArcBridgeService : public arc::ArcBridgeService {
16 public:
17 struct AppInfo {
18 std::string id() const;
19
20 const char* name;
21 const char* package;
22 const char* activity;
23 };
24
25 struct IconRequest {
26 std::string package;
27 std::string activity;
28 int scale_factor;
29 };
30
31 FakeArcBridgeService();
32 ~FakeArcBridgeService() override;
33
34 // arc::ArcBridgeService
35 void HandleStartup() override;
36 void Shutdown() override;
37 bool RegisterInputDevice(const std::string& name,
38 const std::string& device_type,
39 base::ScopedFD fd) override;
40 bool RefreshApps() override;
41 bool LaunchApp(const std::string& package,
42 const std::string& activity) override;
43 bool RequestIcon(const std::string& package,
44 const std::string& activity,
45 int scale_factor) override;
46
47 int refresh_apps_cnt() const { return refresh_apps_cnt_; }
Luis Héctor Chávez 2015/11/18 18:22:19 As before, don't abbreviate 'count'.
48
49 const std::vector<std::string>& launch_requests() const {
50 return launch_requests_;
51 }
52
53 const std::vector<IconRequest>& icon_requests() const {
54 return icon_requests_;
55 }
56
57 void SetReady();
58
59 void SetStopped();
60
61 bool HasObserver(const Observer* observer) const;
62
63 void SendRefreshApps(size_t size, const AppInfo* apps);
64
65 bool GenerateAndSendIcon(const AppInfo& app,
66 ui::ScaleFactor scale_factor,
67 std::vector<unsigned char>* png_data);
68
69 private:
70 // Number of RefreshApps calls.
71 int refresh_apps_cnt_;
72 // Keeps information about launch requests.
73 std::vector<std::string> launch_requests_;
74 // Keeps information about icon load requests.
75 std::vector<IconRequest> icon_requests_;
76
77 DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeService);
78 };
79
80 #endif // CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNC HER_H_
OLDNEW

Powered by Google App Engine