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> |
(...skipping 25 matching lines...) Expand all Loading... | |
36 enum class CloseReason : int { | 36 enum class CloseReason : int { |
37 ERROR = 0, | 37 ERROR = 0, |
38 DIALOG_DEACTIVATED = 1, | 38 DIALOG_DEACTIVATED = 1, |
39 ALWAYS_PRESSED = 2, | 39 ALWAYS_PRESSED = 2, |
40 JUST_ONCE_PRESSED = 3, | 40 JUST_ONCE_PRESSED = 3, |
41 PREFERRED_ACTIVITY_FOUND = 4, | 41 PREFERRED_ACTIVITY_FOUND = 4, |
42 SIZE, | 42 SIZE, |
43 INVALID = SIZE, | 43 INVALID = SIZE, |
44 }; | 44 }; |
45 | 45 |
46 enum class Platform : int { | |
Yusuke Sato
2016/11/04 00:16:14
please add an enum description (like L33-35).
djacobo_
2016/11/04 05:53:50
Done.
| |
47 ARC = 0, | |
48 CHROME = 1, | |
49 SIZE, | |
50 }; | |
51 | |
46 // Restricts the amount of apps displayed to the user without the need of a | 52 // Restricts the amount of apps displayed to the user without the need of a |
47 // ScrollView. | 53 // ScrollView. |
48 enum { kMaxAppResults = 3 }; | 54 enum { kMaxAppResults = 3 }; |
49 | 55 |
50 struct AppInfo { | 56 struct AppInfo { |
51 AppInfo(gfx::Image img, std::string package, std::string activity) | 57 AppInfo(gfx::Image img, std::string package, std::string activity) |
52 : icon(img), package_name(package), activity_name(activity) {} | 58 : icon(img), package_name(package), activity_name(activity) {} |
53 gfx::Image icon; | 59 gfx::Image icon; |
54 std::string package_name; | 60 std::string package_name; |
55 std::string activity_name; | 61 std::string activity_name; |
(...skipping 16 matching lines...) Expand all Loading... | |
72 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, | 78 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, |
73 const std::string& selected_app_package); | 79 const std::string& selected_app_package); |
74 | 80 |
75 static bool IsAppAvailableForTesting( | 81 static bool IsAppAvailableForTesting( |
76 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); | 82 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); |
77 static size_t FindPreferredAppForTesting( | 83 static size_t FindPreferredAppForTesting( |
78 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); | 84 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); |
79 static bool IsSwapElementsNeededForTesting( | 85 static bool IsSwapElementsNeededForTesting( |
80 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, | 86 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, |
81 std::pair<size_t, size_t>* out_indices); | 87 std::pair<size_t, size_t>* out_indices); |
88 static Platform GetDestinationPlatform( | |
Yusuke Sato
2016/11/04 00:16:14
* Since this is a public function, it's better to
djacobo_
2016/11/04 05:53:50
Moved and added comments, let me know what you thi
| |
89 const std::string& selected_app_package, | |
90 CloseReason close_reason); | |
82 | 91 |
83 private: | 92 private: |
84 // content::Navigation implementation: | 93 // content::Navigation implementation: |
85 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | 94 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
86 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; | 95 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; |
87 | 96 |
88 NavigationThrottle::ThrottleCheckResult HandleRequest(); | 97 NavigationThrottle::ThrottleCheckResult HandleRequest(); |
89 void OnAppCandidatesReceived( | 98 void OnAppCandidatesReceived( |
90 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); | 99 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); |
91 void OnAppIconsReceived( | 100 void OnAppIconsReceived( |
(...skipping 19 matching lines...) Expand all Loading... | |
111 | 120 |
112 // This has to be the last member of the class. | 121 // This has to be the last member of the class. |
113 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; | 122 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; |
114 | 123 |
115 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); | 124 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); |
116 }; | 125 }; |
117 | 126 |
118 } // namespace arc | 127 } // namespace arc |
119 | 128 |
120 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ | 129 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ |
OLD | NEW |