| 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_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "components/arc/intent_helper/activity_icon_loader.h" | 16 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
| 17 #include "content/public/browser/navigation_throttle.h" | 17 #include "content/public/browser/navigation_throttle.h" |
| 18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class NavigationHandle; | 22 class NavigationHandle; |
| 23 class WebContents; | 23 class WebContents; |
| 24 } // namespace content | 24 } // namespace content |
| 25 | 25 |
| 26 namespace arc { | 26 namespace arc { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 private: | 106 private: |
| 107 // content::Navigation implementation: | 107 // content::Navigation implementation: |
| 108 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | 108 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
| 109 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; | 109 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; |
| 110 | 110 |
| 111 NavigationThrottle::ThrottleCheckResult HandleRequest(); | 111 NavigationThrottle::ThrottleCheckResult HandleRequest(); |
| 112 void OnAppCandidatesReceived( | 112 void OnAppCandidatesReceived( |
| 113 std::vector<mojom::IntentHandlerInfoPtr> handlers); | 113 std::vector<mojom::IntentHandlerInfoPtr> handlers); |
| 114 void OnAppIconsReceived( | 114 void OnAppIconsReceived( |
| 115 std::vector<mojom::IntentHandlerInfoPtr> handlers, | 115 std::vector<mojom::IntentHandlerInfoPtr> handlers, |
| 116 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons); | 116 std::unique_ptr<ArcIntentHelperBridge::ActivityToIconsMap> icons); |
| 117 void OnIntentPickerClosed(std::vector<mojom::IntentHandlerInfoPtr> handlers, | 117 void OnIntentPickerClosed(std::vector<mojom::IntentHandlerInfoPtr> handlers, |
| 118 const std::string& selected_app_package, | 118 const std::string& selected_app_package, |
| 119 CloseReason close_reason); | 119 CloseReason close_reason); |
| 120 GURL GetStartingGURL() const; | 120 GURL GetStartingGURL() const; |
| 121 // A callback object that allow us to display an IntentPicker when Run() is | 121 // A callback object that allow us to display an IntentPicker when Run() is |
| 122 // executed, it also allow us to report the user's selection back to | 122 // executed, it also allow us to report the user's selection back to |
| 123 // OnIntentPickerClosed(). | 123 // OnIntentPickerClosed(). |
| 124 ShowIntentPickerCallback show_intent_picker_callback_; | 124 ShowIntentPickerCallback show_intent_picker_callback_; |
| 125 | 125 |
| 126 // A cache of the action the user took the last time this navigation throttle | 126 // A cache of the action the user took the last time this navigation throttle |
| 127 // popped up the intent picker dialog. If the dialog has never been popped up | 127 // popped up the intent picker dialog. If the dialog has never been popped up |
| 128 // before, this will have a value of CloseReason::INVALID. Used to avoid | 128 // before, this will have a value of CloseReason::INVALID. Used to avoid |
| 129 // popping up the dialog multiple times on chains of multiple redirects. | 129 // popping up the dialog multiple times on chains of multiple redirects. |
| 130 CloseReason previous_user_action_; | 130 CloseReason previous_user_action_; |
| 131 | 131 |
| 132 // Keeps a referrence to the starting GURL. | 132 // Keeps a referrence to the starting GURL. |
| 133 GURL starting_gurl_; | 133 GURL starting_gurl_; |
| 134 | 134 |
| 135 // This has to be the last member of the class. | 135 // This has to be the last member of the class. |
| 136 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; | 136 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); | 138 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace arc | 141 } // namespace arc |
| 142 | 142 |
| 143 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ | 143 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ |
| OLD | NEW |