| 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/activity_icon_loader.h" |
| 17 #include "content/public/browser/navigation_throttle.h" | 17 #include "content/public/browser/navigation_throttle.h" |
| 18 #include "mojo/public/cpp/bindings/array.h" | 18 #include "mojo/public/cpp/bindings/array.h" |
| 19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 20 | 20 #include "url/gurl.h" |
| 21 class GURL; | |
| 22 | 21 |
| 23 namespace content { | 22 namespace content { |
| 24 class NavigationHandle; | 23 class NavigationHandle; |
| 25 class WebContents; | 24 class WebContents; |
| 26 } // namespace content | 25 } // namespace content |
| 27 | 26 |
| 28 namespace arc { | 27 namespace arc { |
| 29 | 28 |
| 30 // A class that allow us to retrieve ARC app's information and handle URL | 29 // A class that allow us to retrieve ARC app's information and handle URL |
| 31 // traffic initiated on Chrome browser, either on Chrome or an ARC's app. | 30 // traffic initiated on Chrome browser, either on Chrome or an ARC's app. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 87 |
| 89 NavigationThrottle::ThrottleCheckResult HandleRequest(); | 88 NavigationThrottle::ThrottleCheckResult HandleRequest(); |
| 90 void OnAppCandidatesReceived( | 89 void OnAppCandidatesReceived( |
| 91 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); | 90 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); |
| 92 void OnAppIconsReceived( | 91 void OnAppIconsReceived( |
| 93 mojo::Array<mojom::IntentHandlerInfoPtr> handlers, | 92 mojo::Array<mojom::IntentHandlerInfoPtr> handlers, |
| 94 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons); | 93 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons); |
| 95 void OnIntentPickerClosed(mojo::Array<mojom::IntentHandlerInfoPtr> handlers, | 94 void OnIntentPickerClosed(mojo::Array<mojom::IntentHandlerInfoPtr> handlers, |
| 96 const std::string& selected_app_package, | 95 const std::string& selected_app_package, |
| 97 CloseReason close_reason); | 96 CloseReason close_reason); |
| 97 GURL GetStartingGURL() const; |
| 98 // A callback object that allow us to display an IntentPicker when Run() is | 98 // A callback object that allow us to display an IntentPicker when Run() is |
| 99 // executed, it also allow us to report the user's selection back to | 99 // executed, it also allow us to report the user's selection back to |
| 100 // OnIntentPickerClosed(). | 100 // OnIntentPickerClosed(). |
| 101 ShowIntentPickerCallback show_intent_picker_callback_; | 101 ShowIntentPickerCallback show_intent_picker_callback_; |
| 102 | 102 |
| 103 // A cache of the action the user took the last time this navigation throttle | 103 // A cache of the action the user took the last time this navigation throttle |
| 104 // popped up the intent picker dialog. If the dialog has never been popped up | 104 // popped up the intent picker dialog. If the dialog has never been popped up |
| 105 // before, this will have a value of CloseReason::INVALID. Used to avoid | 105 // before, this will have a value of CloseReason::INVALID. Used to avoid |
| 106 // popping up the dialog multiple times on chains of multiple redirects. | 106 // popping up the dialog multiple times on chains of multiple redirects. |
| 107 CloseReason previous_user_action_; | 107 CloseReason previous_user_action_; |
| 108 | 108 |
| 109 // Keeps a referrence to the starting GURL. |
| 110 GURL starting_gurl_; |
| 111 |
| 109 // This has to be the last member of the class. | 112 // This has to be the last member of the class. |
| 110 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; | 113 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; |
| 111 | 114 |
| 112 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); | 115 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace arc | 118 } // namespace arc |
| 116 | 119 |
| 117 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ | 120 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ |
| OLD | NEW |