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. |
Ilya Sherman
2016/06/28 03:17:15
nit: Please also document that this enum should be
Yusuke Sato
2016/06/28 05:04:23
Done.
| |
31 REASON_JUST_ONCE_PRESSED, | 31 enum class CloseReason : int { |
32 REASON_DIALOG_DEACTIVATED, | 32 REASON_ALWAYS_PRESSED = 0, |
33 REASON_PREFERRED_ACTIVITY_FOUND, | 33 REASON_JUST_ONCE_PRESSED = 1, |
34 REASON_ERROR | 34 REASON_PREFERRED_ACTIVITY_FOUND = 2, |
35 REASON_DIALOG_DEACTIVATED = 3, | |
36 REASON_ERROR = 4, | |
Ilya Sherman
2016/06/28 03:17:15
Optional nit: I'd omit the "REASON_" prefix since
Yusuke Sato
2016/06/28 05:04:23
Done.
| |
37 SIZE, | |
35 }; | 38 }; |
36 | 39 |
37 using NameAndIcon = std::pair<std::string, gfx::Image>; | 40 using NameAndIcon = std::pair<std::string, gfx::Image>; |
38 using ShowDisambigDialogCallback = | 41 using ShowDisambigDialogCallback = |
39 base::Callback<void(content::NavigationHandle* handle, | 42 base::Callback<void(content::NavigationHandle* handle, |
40 const std::vector<NameAndIcon>& app_info, | 43 const std::vector<NameAndIcon>& app_info, |
41 const base::Callback<void(size_t, CloseReason)>& cb)>; | 44 const base::Callback<void(size_t, CloseReason)>& cb)>; |
42 ArcNavigationThrottle( | 45 ArcNavigationThrottle( |
43 content::NavigationHandle* navigation_handle, | 46 content::NavigationHandle* navigation_handle, |
44 const ShowDisambigDialogCallback& show_disambig_dialog_cb); | 47 const ShowDisambigDialogCallback& show_disambig_dialog_cb); |
(...skipping 18 matching lines...) Expand all Loading... | |
63 ShowDisambigDialogCallback show_disambig_dialog_callback_; | 66 ShowDisambigDialogCallback show_disambig_dialog_callback_; |
64 | 67 |
65 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; | 68 base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_; |
66 | 69 |
67 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); | 70 DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle); |
68 }; | 71 }; |
69 | 72 |
70 } // namespace arc | 73 } // namespace arc |
71 | 74 |
72 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_NAVIGATION_THROTTLE_H_ |
OLD | NEW |