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

Unified Diff: chrome/browser/chromeos/arc/arc_navigation_throttle.h

Issue 2194523002: [arc-intents] Handle redirects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync/rebase. Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_navigation_throttle.h
diff --git a/chrome/browser/chromeos/arc/arc_navigation_throttle.h b/chrome/browser/chromeos/arc/arc_navigation_throttle.h
index 0690af2a6a8951b2f5219f952ffef5cc7425dc5b..7a9fba361c86057b970c708f38114ca8805a8fdf 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.h
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.h
@@ -37,6 +37,7 @@ class ArcNavigationThrottle : public content::NavigationThrottle {
JUST_ONCE_PRESSED = 3,
PREFERRED_ACTIVITY_FOUND = 4,
SIZE,
+ INVALID = SIZE,
};
// Restricts the amount of apps displayed to the user without the need of a
@@ -44,13 +45,12 @@ class ArcNavigationThrottle : public content::NavigationThrottle {
enum { kMaxAppResults = 3 };
using NameAndIcon = std::pair<std::string, gfx::Image>;
- using ShowDisambigDialogCallback =
+ using ShowIntentPickerCallback =
base::Callback<void(content::NavigationHandle* handle,
const std::vector<NameAndIcon>& app_info,
const base::Callback<void(size_t, CloseReason)>& cb)>;
- ArcNavigationThrottle(
- content::NavigationHandle* navigation_handle,
- const ShowDisambigDialogCallback& show_disambig_dialog_cb);
+ ArcNavigationThrottle(content::NavigationHandle* navigation_handle,
+ const ShowIntentPickerCallback& show_intent_picker_cb);
~ArcNavigationThrottle() override;
private:
@@ -58,22 +58,30 @@ class ArcNavigationThrottle : public content::NavigationThrottle {
NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
+ NavigationThrottle::ThrottleCheckResult HandleRequest();
void OnAppCandidatesReceived(mojo::Array<mojom::UrlHandlerInfoPtr> handlers);
void OnAppIconsReceived(
mojo::Array<mojom::UrlHandlerInfoPtr> handlers,
std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons);
- void OnDisambigDialogClosed(mojo::Array<mojom::UrlHandlerInfoPtr> handlers,
- size_t selected_app_index,
- CloseReason close_reason);
+ void OnIntentPickerClosed(mojo::Array<mojom::UrlHandlerInfoPtr> handlers,
+ size_t selected_app_index,
+ CloseReason close_reason);
// Compares the host name of the referrer and target URL to decide whether
// the navigation needs to be overriden.
bool ShouldOverrideUrlLoading(content::NavigationHandle* navigation_handle);
// A callback object that allow us to display an IntentPicker when Run() is
// executed, it also allow us to report the user's selection back to
- // OnDisambigDialogClosed().
- ShowDisambigDialogCallback show_disambig_dialog_callback_;
+ // OnIntentPickerClosed().
+ ShowIntentPickerCallback show_intent_picker_callback_;
+ // A cache of the action the user took the last time this navigation throttle
+ // popped up the intent picker dialog. If the dialog has never been popped up
+ // before, this will have a value of CloseReason::INVALID. Used to avoid
+ // popping up the dialog multiple times on chains of multiple redirects.
+ CloseReason previous_user_action_;
+
+ // This has to be the last member of the class.
base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle);
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/chromeos/arc/arc_navigation_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698