| 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_ARC_NAVIGATION_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "components/arc/intent_helper/activity_icon_loader.h" | 15 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 16 #include "content/public/browser/navigation_throttle.h" | 16 #include "content/public/browser/navigation_throttle.h" |
| 17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class NavigationHandle; | 20 class NavigationHandle; |
| 21 } // namespace content | 21 } // namespace content |
| 22 | 22 |
| 23 namespace arc { | 23 namespace arc { |
| 24 | 24 |
| 25 // A class that allow us to retrieve ARC app's information and handle URL | 25 // A class that allow us to retrieve ARC app's information and handle URL |
| 26 // traffic initiated on Chrome browser, either on Chrome or an ARC's app. | 26 // traffic initiated on Chrome browser, either on Chrome or an ARC's app. |
| 27 class ArcNavigationThrottle : public content::NavigationThrottle { | 27 class ArcNavigationThrottle : public content::NavigationThrottle { |
| 28 public: | 28 public: |
| 29 enum class CloseReason { | 29 // These enums are used to define the buckets for an enumerated UMA histogram |
| 30 REASON_ALWAYS_PRESSED, | 30 // and need to be synced with histograms.xml. This enum class should also be |
| 31 REASON_JUST_ONCE_PRESSED, | 31 // treated as append-only. |
| 32 REASON_DIALOG_DEACTIVATED, | 32 enum class CloseReason : int { |
| 33 REASON_PREFERRED_ACTIVITY_FOUND, | 33 ERROR = 0, |
| 34 REASON_ERROR | 34 DIALOG_DEACTIVATED = 1, |
| 35 ALWAYS_PRESSED = 2, |
| 36 JUST_ONCE_PRESSED = 3, |
| 37 PREFERRED_ACTIVITY_FOUND = 4, |
| 38 SIZE, |
| 35 }; | 39 }; |
| 36 | 40 |
| 37 using NameAndIcon = std::pair<std::string, gfx::Image>; | 41 using NameAndIcon = std::pair<std::string, gfx::Image>; |
| 38 using ShowDisambigDialogCallback = | 42 using ShowDisambigDialogCallback = |
| 39 base::Callback<void(content::NavigationHandle* handle, | 43 base::Callback<void(content::NavigationHandle* handle, |
| 40 const std::vector<NameAndIcon>& app_info, | 44 const std::vector<NameAndIcon>& app_info, |
| 41 const base::Callback<void(size_t, CloseReason)>& cb)>; | 45 const base::Callback<void(size_t, CloseReason)>& cb)>; |
| 42 ArcNavigationThrottle( | 46 ArcNavigationThrottle( |
| 43 content::NavigationHandle* navigation_handle, | 47 content::NavigationHandle* navigation_handle, |
| 44 const ShowDisambigDialogCallback& show_disambig_dialog_cb); | 48 const ShowDisambigDialogCallback& show_disambig_dialog_cb); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 ShowDisambigDialogCallback show_disambig_dialog_callback_; | 67 ShowDisambigDialogCallback show_disambig_dialog_callback_; |
| 64 | 68 |
| 65 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; | 69 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; |
| 66 | 70 |
| 67 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); | 71 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 } // namespace arc | 74 } // namespace arc |
| 71 | 75 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ |
| OLD | NEW |