| 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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ | 4 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ |
| 5 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ | 5 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ |
| 6 | 6 |
| 7 #include "ash/renderer_context_menu/open_with_menu_controller.h" |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/arc/open_with_menu_controller_delegate.h" |
| 9 #include "chrome/browser/chromeos/arc/settings_bridge.h" | 11 #include "chrome/browser/chromeos/arc/settings_bridge.h" |
| 10 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_service.h" |
| 11 #include "components/arc/arc_service.h" | 13 #include "components/arc/arc_service.h" |
| 12 #include "components/arc/common/intent_helper.mojom.h" | 14 #include "components/arc/common/intent_helper.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 14 | 16 |
| 15 namespace arc { | 17 namespace arc { |
| 16 | 18 |
| 17 // Receives intents from ARC. | 19 // Receives intents from ARC. |
| 18 class ArcIntentHelperBridge : public ArcService, | 20 class ArcIntentHelperBridge : public ArcService, |
| 19 public ArcBridgeService::Observer, | 21 public ArcBridgeService::Observer, |
| 20 public IntentHelperHost, | 22 public IntentHelperHost, |
| 23 public ash::OpenWithMenuController::Delegate, |
| 21 public SettingsBridge::Delegate { | 24 public SettingsBridge::Delegate { |
| 22 public: | 25 public: |
| 23 explicit ArcIntentHelperBridge(ArcBridgeService* bridge_service); | 26 explicit ArcIntentHelperBridge(ArcBridgeService* bridge_service); |
| 24 ~ArcIntentHelperBridge() override; | 27 ~ArcIntentHelperBridge() override; |
| 25 | 28 |
| 26 // ArcBridgeService::Observer | 29 // ArcBridgeService::Observer |
| 27 void OnIntentHelperInstanceReady() override; | 30 void OnIntentHelperInstanceReady() override; |
| 28 void OnIntentHelperInstanceClosed() override; | 31 void OnIntentHelperInstanceClosed() override; |
| 29 | 32 |
| 30 // SettingsBridge::Delegate. Sends a broadcast to the ArcIntentHelper app | 33 // SettingsBridge::Delegate. Sends a broadcast to the ArcIntentHelper app |
| 31 // in Android. | 34 // in Android. |
| 32 void OnBroadcastNeeded(const std::string& action, | 35 void OnBroadcastNeeded(const std::string& action, |
| 33 const base::DictionaryValue& extras) override; | 36 const base::DictionaryValue& extras) override; |
| 34 | 37 |
| 35 // arc::IntentHelperHost | 38 // arc::IntentHelperHost |
| 36 void OnOpenUrl(const mojo::String& url) override; | 39 void OnOpenUrl(const mojo::String& url) override; |
| 37 | 40 |
| 41 // ash::OpenWithMenuController::Delegate |
| 42 int PopulateOpenWithMenu(RenderViewContextMenuProxy* proxy, |
| 43 int menu_id_start, |
| 44 size_t num_menu_items, |
| 45 const GURL& url) override; |
| 46 void ExecuteCommand(int id) override; |
| 47 void MenuClosed() override; |
| 48 |
| 38 private: | 49 private: |
| 39 mojo::Binding<IntentHelperHost> binding_; | 50 mojo::Binding<IntentHelperHost> binding_; |
| 40 scoped_ptr<SettingsBridge> settings_bridge_; | 51 scoped_ptr<SettingsBridge> settings_bridge_; |
| 52 scoped_ptr<OpenWithMenuControllerDelegate> menu_delegate_impl_; |
| 41 | 53 |
| 42 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); | 54 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); |
| 43 }; | 55 }; |
| 44 | 56 |
| 45 } // namespace arc | 57 } // namespace arc |
| 46 | 58 |
| 47 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ | 59 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_INTENT_HELPER_BRIDGE_H_ |
| OLD | NEW |