OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/bookmark_app_helper.h" | 5 #include "chrome/browser/extensions/bookmark_app_helper.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 FinishInstallation(); | 246 FinishInstallation(); |
247 Release(); | 247 Release(); |
248 } | 248 } |
249 | 249 |
250 void DownloadNextImage() { | 250 void DownloadNextImage() { |
251 DCHECK(urls_to_download_.size()); | 251 DCHECK(urls_to_download_.size()); |
252 | 252 |
253 bitmap_fetcher_.reset( | 253 bitmap_fetcher_.reset( |
254 new chrome::BitmapFetcher(urls_to_download_.back(), this)); | 254 new chrome::BitmapFetcher(urls_to_download_.back(), this)); |
255 urls_to_download_.pop_back(); | 255 urls_to_download_.pop_back(); |
256 bitmap_fetcher_->Start( | 256 bitmap_fetcher_->Init( |
257 service_->profile()->GetRequestContext(), std::string(), | 257 service_->profile()->GetRequestContext(), std::string(), |
258 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 258 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
259 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); | 259 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); |
| 260 bitmap_fetcher_->Start(); |
260 } | 261 } |
261 | 262 |
262 void FinishInstallation() { | 263 void FinishInstallation() { |
263 std::map<int, BookmarkAppHelper::BitmapAndSource> size_map = | 264 std::map<int, BookmarkAppHelper::BitmapAndSource> size_map = |
264 BookmarkAppHelper::ResizeIconsAndGenerateMissing(downloaded_bitmaps_, | 265 BookmarkAppHelper::ResizeIconsAndGenerateMissing(downloaded_bitmaps_, |
265 &web_app_info_); | 266 &web_app_info_); |
266 BookmarkAppHelper::UpdateWebAppIconsWithoutChangingLinks(size_map, | 267 BookmarkAppHelper::UpdateWebAppIconsWithoutChangingLinks(size_map, |
267 &web_app_info_); | 268 &web_app_info_); |
268 scoped_refptr<extensions::CrxInstaller> installer( | 269 scoped_refptr<extensions::CrxInstaller> installer( |
269 extensions::CrxInstaller::CreateSilent(service_)); | 270 extensions::CrxInstaller::CreateSilent(service_)); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 714 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
714 } | 715 } |
715 | 716 |
716 bool IsValidBookmarkAppUrl(const GURL& url) { | 717 bool IsValidBookmarkAppUrl(const GURL& url) { |
717 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); | 718 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); |
718 origin_only_pattern.SetMatchAllURLs(true); | 719 origin_only_pattern.SetMatchAllURLs(true); |
719 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 720 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
720 } | 721 } |
721 | 722 |
722 } // namespace extensions | 723 } // namespace extensions |
OLD | NEW |