Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h

Issue 2478923002: Ensure that Chrome is visible in the dialog by default (Closed)
Patch Set: review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 static bool ShouldOverrideUrlLoadingForTesting(const GURL& previous_url, 66 static bool ShouldOverrideUrlLoadingForTesting(const GURL& previous_url,
67 const GURL& current_url); 67 const GURL& current_url);
68 68
69 // Finds |selected_app_package| from the |handlers| array and returns the 69 // Finds |selected_app_package| from the |handlers| array and returns the
70 // index. If the app is not found, returns |handlers.size()|. 70 // index. If the app is not found, returns |handlers.size()|.
71 static size_t GetAppIndex( 71 static size_t GetAppIndex(
72 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 72 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
73 const std::string& selected_app_package); 73 const std::string& selected_app_package);
74 74
75 // Swaps Chrome app with any app in row |kMaxAppResults-1| iff its index is
Yusuke Sato 2016/11/05 01:19:26 copied the comment from .cc as-is.
76 // bigger, thus ensuring the user can always see Chrome without scrolling.
77 // When swap is needed, fills |out_indices| and returns true. If |handlers|
78 // do not have Chrome, returns false.
79 static bool IsSwapElementsNeeded(
80 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
81 std::pair<size_t, size_t>* out_indices);
82
75 static bool IsAppAvailableForTesting( 83 static bool IsAppAvailableForTesting(
76 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); 84 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers);
77 static size_t FindPreferredAppForTesting( 85 static size_t FindPreferredAppForTesting(
78 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); 86 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers);
79 static bool IsSwapElementsNeededForTesting(
80 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
81 std::pair<size_t, size_t>* out_indices);
82 87
83 private: 88 private:
84 // content::Navigation implementation: 89 // content::Navigation implementation:
85 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; 90 NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
86 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; 91 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
87 92
88 NavigationThrottle::ThrottleCheckResult HandleRequest(); 93 NavigationThrottle::ThrottleCheckResult HandleRequest();
89 void OnAppCandidatesReceived( 94 void OnAppCandidatesReceived(
90 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); 95 mojo::Array<mojom::IntentHandlerInfoPtr> handlers);
91 void OnAppIconsReceived( 96 void OnAppIconsReceived(
(...skipping 19 matching lines...) Expand all
111 116
112 // This has to be the last member of the class. 117 // This has to be the last member of the class.
113 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; 118 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_;
114 119
115 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); 120 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle);
116 }; 121 };
117 122
118 } // namespace arc 123 } // namespace arc
119 124
120 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ 125 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698