| 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 "components/arc/intent_helper/link_handler_model_impl.h" | 5 #include "components/arc/intent_helper/link_handler_model_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { | 108 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { |
| 109 handlers_ = std::move(handlers); | 109 handlers_ = std::move(handlers); |
| 110 | 110 |
| 111 bool icon_info_notified = false; | 111 bool icon_info_notified = false; |
| 112 if (icon_loader_) { | 112 if (icon_loader_) { |
| 113 std::vector<ActivityIconLoader::ActivityName> activities; | 113 std::vector<ActivityIconLoader::ActivityName> activities; |
| 114 for (size_t i = 0; i < handlers_.size(); ++i) { | 114 for (size_t i = 0; i < handlers_.size(); ++i) { |
| 115 activities.emplace_back(handlers_[i]->package_name, | 115 activities.emplace_back(handlers_[i]->package_name, |
| 116 handlers_[i]->activity_name); | 116 handlers_[i]->activity_name); |
| 117 } | 117 } |
| 118 icon_info_notified = icon_loader_->GetActivityIcons( | 118 const ActivityIconLoader::GetResult result = icon_loader_->GetActivityIcons( |
| 119 activities, base::Bind(&LinkHandlerModelImpl::NotifyObserver, | 119 activities, base::Bind(&LinkHandlerModelImpl::NotifyObserver, |
| 120 weak_ptr_factory_.GetWeakPtr())); | 120 weak_ptr_factory_.GetWeakPtr())); |
| 121 icon_info_notified = ActivityIconLoader::HasIconsReadyCallbackRun(result); |
| 121 } | 122 } |
| 122 | 123 |
| 123 if (!icon_info_notified) { | 124 if (!icon_info_notified) { |
| 124 // Call NotifyObserver() without icon information, unless | 125 // Call NotifyObserver() without icon information, unless |
| 125 // GetActivityIcons has already called it. Otherwise if we delay the | 126 // GetActivityIcons has already called it. Otherwise if we delay the |
| 126 // notification waiting for all icons, context menu may flicker. | 127 // notification waiting for all icons, context menu may flicker. |
| 127 NotifyObserver(nullptr); | 128 NotifyObserver(nullptr); |
| 128 } | 129 } |
| 129 } | 130 } |
| 130 | 131 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (!GetQueryValue(url, kKeyToFind, &value)) | 173 if (!GetQueryValue(url, kKeyToFind, &value)) |
| 173 return url; | 174 return url; |
| 174 | 175 |
| 175 const GURL new_url(value); | 176 const GURL new_url(value); |
| 176 if (!new_url.is_valid()) | 177 if (!new_url.is_valid()) |
| 177 return url; | 178 return url; |
| 178 return new_url; | 179 return new_url; |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace arc | 182 } // namespace arc |
| OLD | NEW |