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

Side by Side Diff: components/arc/intent_helper/link_handler_model_impl.cc

Issue 2034543003: Retry icon fetching after intent_helper is ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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
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 =
122 (result != ActivityIconLoader::GetResult::SUCCEEDED_ASYNC);
Luis Héctor Chávez 2016/06/02 16:59:47 Isn't the intention "result == ActivityIconLoader:
Yusuke Sato 2016/06/02 18:03:19 GetResult::FAILED_* also run the callback actually
Luis Héctor Chávez 2016/06/02 20:03:51 Makes more sense now :) nit: Can you add a small
Yusuke Sato 2016/06/02 21:07:27 Great idea, done.
121 } 123 }
122 124
123 if (!icon_info_notified) { 125 if (!icon_info_notified) {
124 // Call NotifyObserver() without icon information, unless 126 // Call NotifyObserver() without icon information, unless
125 // GetActivityIcons has already called it. Otherwise if we delay the 127 // GetActivityIcons has already called it. Otherwise if we delay the
126 // notification waiting for all icons, context menu may flicker. 128 // notification waiting for all icons, context menu may flicker.
127 NotifyObserver(nullptr); 129 NotifyObserver(nullptr);
128 } 130 }
129 } 131 }
130 132
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!GetQueryValue(url, kKeyToFind, &value)) 174 if (!GetQueryValue(url, kKeyToFind, &value))
173 return url; 175 return url;
174 176
175 const GURL new_url(value); 177 const GURL new_url(value);
176 if (!new_url.is_valid()) 178 if (!new_url.is_valid())
177 return url; 179 return url;
178 return new_url; 180 return new_url;
179 } 181 }
180 182
181 } // namespace arc 183 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698