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

Side by Side Diff: chrome/browser/chromeos/arc/extensions/fake_arc_support.h

Issue 2844383006: Turn ArcSupportHost from Observer model to Delegate (Closed)
Patch Set: rebase Created 3 years, 6 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
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 10 matching lines...) Expand all
21 explicit FakeArcSupport(ArcSupportHost* support_host); 21 explicit FakeArcSupport(ArcSupportHost* support_host);
22 ~FakeArcSupport() override; 22 ~FakeArcSupport() override;
23 23
24 // Emulates to open ARC support Chrome app, and connect message host to 24 // Emulates to open ARC support Chrome app, and connect message host to
25 // ARC support host. 25 // ARC support host.
26 void Open(Profile* profile); 26 void Open(Profile* profile);
27 27
28 // Emulates clicking Close button. 28 // Emulates clicking Close button.
29 void Close(); 29 void Close();
30 30
31 // Authentication page emulation.
32 void EmulateAuthCodeResponse(const std::string& auth_code);
33 void EmulateAuthFailure();
34
31 // Terms of service page emulation. 35 // Terms of service page emulation.
32 // Emulates clicking Agree button. 36 // Emulates clicking Agree button.
33 void ClickAgreeButton(); 37 void ClickAgreeButton();
34 38
35 bool metrics_mode() const { return metrics_mode_; } 39 bool metrics_mode() const { return metrics_mode_; }
36 bool backup_and_restore_mode() const { return backup_and_restore_mode_; } 40 bool backup_and_restore_mode() const { return backup_and_restore_mode_; }
37 bool location_service_mode() const { return location_service_mode_; } 41 bool location_service_mode() const { return location_service_mode_; }
38 42
39 // Emulates checking preference box. 43 // Emulates checking preference box.
40 void set_metrics_mode(bool mode) { metrics_mode_ = mode; } 44 void set_metrics_mode(bool mode) { metrics_mode_ = mode; }
41 void set_backup_and_restore_mode(bool mode) { 45 void set_backup_and_restore_mode(bool mode) {
42 backup_and_restore_mode_ = mode; 46 backup_and_restore_mode_ = mode;
43 } 47 }
44 void set_location_service_mode(bool mode) { location_service_mode_ = mode; } 48 void set_location_service_mode(bool mode) { location_service_mode_ = mode; }
45 49
46 // Error page emulation. 50 // Error page emulation.
47 void ClickRetryButton(); 51 void ClickRetryButton();
52 void ClickSendFeedbackButton();
48 53
49 // Returns the current page. 54 // Returns the current page.
50 ArcSupportHost::UIPage ui_page() const { return ui_page_; } 55 ArcSupportHost::UIPage ui_page() const { return ui_page_; }
51 56
52 private: 57 private:
58 void UnsetMessageHost();
59
53 // extensions::NativeMessageHost::Client: 60 // extensions::NativeMessageHost::Client:
54 void PostMessageFromNativeHost(const std::string& message) override; 61 void PostMessageFromNativeHost(const std::string& message) override;
55 void CloseChannel(const std::string& error_message) override; 62 void CloseChannel(const std::string& error_message) override;
63 void OnMessage(const base::DictionaryValue& message);
56 64
57 ArcSupportHost* const support_host_; 65 ArcSupportHost* const support_host_;
58 66
59 std::unique_ptr<extensions::NativeMessageHost> native_message_host_; 67 std::unique_ptr<extensions::NativeMessageHost> native_message_host_;
60 ArcSupportHost::UIPage ui_page_ = ArcSupportHost::UIPage::NO_PAGE; 68 ArcSupportHost::UIPage ui_page_ = ArcSupportHost::UIPage::NO_PAGE;
61 bool metrics_mode_ = false; 69 bool metrics_mode_ = false;
62 bool backup_and_restore_mode_ = false; 70 bool backup_and_restore_mode_ = false;
63 bool location_service_mode_ = false; 71 bool location_service_mode_ = false;
64 72
65 base::WeakPtrFactory<FakeArcSupport> weak_ptr_factory_; 73 base::WeakPtrFactory<FakeArcSupport> weak_ptr_factory_;
66 74
67 DISALLOW_COPY_AND_ASSIGN(FakeArcSupport); 75 DISALLOW_COPY_AND_ASSIGN(FakeArcSupport);
68 }; 76 };
69 77
70 } // namespace arc 78 } // namespace arc
71 79
72 #endif // CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_ 80 #endif // CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698