| 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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 9 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 10 #include "extensions/browser/api/messaging/native_message_host.h" | 10 #include "extensions/browser/api/messaging/native_message_host.h" |
| 11 | 11 |
| 12 // Supports communication with Arc support dialog. | 12 // Supports communication with Arc support dialog. |
| 13 class ArcSupportHost : public extensions::NativeMessageHost, | 13 class ArcSupportHost : public extensions::NativeMessageHost, |
| 14 public arc::ArcAuthService::Observer { | 14 public arc::ArcAuthService::Observer { |
| 15 public: | 15 public: |
| 16 static const char kHostName[]; | 16 static const char kHostName[]; |
| 17 static const char kHostAppId[]; |
| 18 static const char kStorageId[]; |
| 17 static const char* const kHostOrigin[]; | 19 static const char* const kHostOrigin[]; |
| 18 | 20 |
| 19 static std::unique_ptr<NativeMessageHost> Create(); | 21 static std::unique_ptr<NativeMessageHost> Create(); |
| 20 | 22 |
| 21 ~ArcSupportHost() override; | 23 ~ArcSupportHost() override; |
| 22 | 24 |
| 23 // Overrides NativeMessageHost: | 25 // Overrides NativeMessageHost: |
| 24 void Start(Client* client) override; | 26 void Start(Client* client) override; |
| 25 void OnMessage(const std::string& request_string) override; | 27 void OnMessage(const std::string& request_string) override; |
| 26 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; | 28 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; |
| 27 | 29 |
| 28 // Overrides arc::ArcAuthService::Observer: | 30 // Overrides arc::ArcAuthService::Observer: |
| 29 void OnOptInUIClose() override; | 31 void OnOptInUIClose() override; |
| 30 void OnOptInUIShowPage(arc::ArcAuthService::UIPage page, | 32 void OnOptInUIShowPage(arc::ArcAuthService::UIPage page, |
| 31 const base::string16& status) override; | 33 const base::string16& status) override; |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 ArcSupportHost(); | 36 ArcSupportHost(); |
| 35 | 37 |
| 36 void SendLocalization(); | 38 void SendLocalization(); |
| 37 | 39 |
| 38 // Unowned pointer. | 40 // Unowned pointer. |
| 39 Client* client_ = nullptr; | 41 Client* client_ = nullptr; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); | 43 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 46 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| OLD | NEW |