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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 1097383005: Add possibility to define data callback to BitmapFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@r479598_extensions_content_verifier_directories_fail
Patch Set: Clarified how calling Init/Start twice works + fixed android Created 5 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698