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 #include "chrome/browser/chromeos/arc/arc_external_protocol_dialog.h" | 5 #include "chrome/browser/chromeos/arc/arc_external_protocol_dialog.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 size_t selected_app_index, | 68 size_t selected_app_index, |
69 ArcNavigationThrottle::CloseReason close_reason) { | 69 ArcNavigationThrottle::CloseReason close_reason) { |
70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
71 | 71 |
72 mojom::IntentHelperInstance* intent_helper = GetIntentHelper(); | 72 mojom::IntentHelperInstance* intent_helper = GetIntentHelper(); |
73 if (!intent_helper || selected_app_index >= handlers.size()) | 73 if (!intent_helper || selected_app_index >= handlers.size()) |
74 close_reason = ArcNavigationThrottle::CloseReason::ERROR; | 74 close_reason = ArcNavigationThrottle::CloseReason::ERROR; |
75 | 75 |
76 switch (close_reason) { | 76 switch (close_reason) { |
77 case ArcNavigationThrottle::CloseReason::ALWAYS_PRESSED: { | 77 case ArcNavigationThrottle::CloseReason::ALWAYS_PRESSED: { |
78 intent_helper->AddPreferredPackage( | 78 // TODO(yusukes): Add NOTREACHED(); break; here once b/31665510 is fixed. |
79 handlers[selected_app_index]->package_name); | 79 // fall through, for now. |
80 // fall through. | |
81 } | 80 } |
82 case ArcNavigationThrottle::CloseReason::JUST_ONCE_PRESSED: | 81 case ArcNavigationThrottle::CloseReason::JUST_ONCE_PRESSED: { |
83 case ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND: { | |
84 // Launch the selected app. | 82 // Launch the selected app. |
85 intent_helper->HandleUrl(url.spec(), | 83 intent_helper->HandleUrl(url.spec(), |
86 handlers[selected_app_index]->package_name); | 84 handlers[selected_app_index]->package_name); |
87 CloseTabIfNeeded(render_process_host_id, routing_id); | 85 CloseTabIfNeeded(render_process_host_id, routing_id); |
88 break; | 86 break; |
89 } | 87 } |
| 88 case ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND: { |
| 89 // Our OnUrlHandlerList callback does not search for a preferred activity. |
| 90 NOTREACHED(); |
| 91 break; |
| 92 } |
90 case ArcNavigationThrottle::CloseReason::ERROR: | 93 case ArcNavigationThrottle::CloseReason::ERROR: |
91 case ArcNavigationThrottle::CloseReason::INVALID: { | 94 case ArcNavigationThrottle::CloseReason::INVALID: { |
92 LOG(ERROR) << "IntentPickerBubbleView returned unexpected close_reason: " | 95 LOG(ERROR) << "IntentPickerBubbleView returned unexpected close_reason: " |
93 << static_cast<int>(close_reason); | 96 << static_cast<int>(close_reason); |
94 // fall through. | 97 // fall through. |
95 } | 98 } |
96 case ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED: { | 99 case ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED: { |
97 // The user didn't select any ARC activity. Show the Chrome OS dialog. | 100 // The user didn't select any ARC activity. Show the Chrome OS dialog. |
98 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id, | 101 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id, |
99 url); | 102 url); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 182 |
180 // Show ARC version of the dialog, which is IntentPickerBubbleView. To show | 183 // Show ARC version of the dialog, which is IntentPickerBubbleView. To show |
181 // the bubble view, we need to ask ARC for a handler list first. | 184 // the bubble view, we need to ask ARC for a handler list first. |
182 intent_helper->RequestUrlHandlerList( | 185 intent_helper->RequestUrlHandlerList( |
183 url.spec(), | 186 url.spec(), |
184 base::Bind(OnUrlHandlerList, render_process_host_id, routing_id, url)); | 187 base::Bind(OnUrlHandlerList, render_process_host_id, routing_id, url)); |
185 return true; | 188 return true; |
186 } | 189 } |
187 | 190 |
188 } // namespace arc | 191 } // namespace arc |
OLD | NEW |