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

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: address review comment 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // |close_reason| is either ERROR or DIALOG_DEACTIVATED the navigation MUST 84 // |close_reason| is either ERROR or DIALOG_DEACTIVATED the navigation MUST
85 // stay in Chrome, otherwise we can assume the navigation goes to ARC with the 85 // stay in Chrome, otherwise we can assume the navigation goes to ARC with the
86 // exception of the |selected_app_package| being Chrome. 86 // exception of the |selected_app_package| being Chrome.
87 static Platform GetDestinationPlatform( 87 static Platform GetDestinationPlatform(
88 const std::string& selected_app_package, 88 const std::string& selected_app_package,
89 CloseReason close_reason); 89 CloseReason close_reason);
90 // Records intent picker usage statistics as well as whether navigations are 90 // Records intent picker usage statistics as well as whether navigations are
91 // continued or redirected to Chrome or ARC respectively, via UMA histograms. 91 // continued or redirected to Chrome or ARC respectively, via UMA histograms.
92 static void RecordUma(CloseReason close_reason, Platform platform); 92 static void RecordUma(CloseReason close_reason, Platform platform);
93 93
94 // Swaps Chrome app with any app in row |kMaxAppResults-1| iff its index is
95 // bigger, thus ensuring the user can always see Chrome without scrolling.
96 // When swap is needed, fills |out_indices| and returns true. If |handlers|
97 // do not have Chrome, returns false.
98 static bool IsSwapElementsNeeded(
99 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
100 std::pair<size_t, size_t>* out_indices);
101
94 static bool IsAppAvailableForTesting( 102 static bool IsAppAvailableForTesting(
95 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); 103 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers);
96 static size_t FindPreferredAppForTesting( 104 static size_t FindPreferredAppForTesting(
97 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers); 105 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers);
98 static bool IsSwapElementsNeededForTesting(
99 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
100 std::pair<size_t, size_t>* out_indices);
101 106
102 private: 107 private:
103 // content::Navigation implementation: 108 // content::Navigation implementation:
104 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; 109 NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
105 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; 110 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
106 111
107 NavigationThrottle::ThrottleCheckResult HandleRequest(); 112 NavigationThrottle::ThrottleCheckResult HandleRequest();
108 void OnAppCandidatesReceived( 113 void OnAppCandidatesReceived(
109 mojo::Array<mojom::IntentHandlerInfoPtr> handlers); 114 mojo::Array<mojom::IntentHandlerInfoPtr> handlers);
110 void OnAppIconsReceived( 115 void OnAppIconsReceived(
(...skipping 19 matching lines...) Expand all
130 135
131 // This has to be the last member of the class. 136 // This has to be the last member of the class.
132 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; 137 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_;
133 138
134 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); 139 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle);
135 }; 140 };
136 141
137 } // namespace arc 142 } // namespace arc
138 143
139 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_ 144 #endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698