OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/apps_promo.h" | 5 #include "chrome/browser/extensions/apps_promo.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 AppsPromo::SetSourcePromoLogoURL(GURL()); | 351 AppsPromo::SetSourcePromoLogoURL(GURL()); |
352 } | 352 } |
353 | 353 |
354 SavePromo(); | 354 SavePromo(); |
355 } | 355 } |
356 | 356 |
357 void AppsPromoLogoFetcher::FetchLogo() { | 357 void AppsPromoLogoFetcher::FetchLogo() { |
358 CHECK(promo_data_.logo.scheme() == chrome::kHttpsScheme); | 358 CHECK(promo_data_.logo.scheme() == chrome::kHttpsScheme); |
359 | 359 |
360 url_fetcher_.reset(content::URLFetcher::Create( | 360 url_fetcher_.reset(content::URLFetcher::Create( |
361 0, promo_data_.logo, content::URLFetcher::GET, this)); | 361 0, promo_data_.logo, net::URLFetcher::GET, this)); |
362 url_fetcher_->SetRequestContext( | 362 url_fetcher_->SetRequestContext( |
363 g_browser_process->system_request_context()); | 363 g_browser_process->system_request_context()); |
364 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 364 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
365 net::LOAD_DO_NOT_SAVE_COOKIES); | 365 net::LOAD_DO_NOT_SAVE_COOKIES); |
366 url_fetcher_->Start(); | 366 url_fetcher_->Start(); |
367 } | 367 } |
368 | 368 |
369 bool AppsPromoLogoFetcher::HaveCachedLogo() { | 369 bool AppsPromoLogoFetcher::HaveCachedLogo() { |
370 return promo_data_.logo == AppsPromo::GetSourcePromoLogoURL(); | 370 return promo_data_.logo == AppsPromo::GetSourcePromoLogoURL(); |
371 } | 371 } |
372 | 372 |
373 void AppsPromoLogoFetcher::SavePromo() { | 373 void AppsPromoLogoFetcher::SavePromo() { |
374 AppsPromo::SetPromo(promo_data_); | 374 AppsPromo::SetPromo(promo_data_); |
375 | 375 |
376 content::NotificationService::current()->Notify( | 376 content::NotificationService::current()->Notify( |
377 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, | 377 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, |
378 content::Source<Profile>(profile_), | 378 content::Source<Profile>(profile_), |
379 content::NotificationService::NoDetails()); | 379 content::NotificationService::NoDetails()); |
380 } | 380 } |
381 | 381 |
382 bool AppsPromoLogoFetcher::SupportsLogoURL() { | 382 bool AppsPromoLogoFetcher::SupportsLogoURL() { |
383 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); | 383 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); |
384 return allowed_urls.MatchesURL(promo_data_.logo); | 384 return allowed_urls.MatchesURL(promo_data_.logo); |
385 } | 385 } |
OLD | NEW |