OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/start_page_service.h" | 5 #include "chrome/browser/ui/app_list/start_page_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 551 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
552 std::string()); | 552 std::string()); |
553 } | 553 } |
554 | 554 |
555 void StartPageService::UnloadContents() { | 555 void StartPageService::UnloadContents() { |
556 contents_.reset(); | 556 contents_.reset(); |
557 webui_finished_loading_ = false; | 557 webui_finished_loading_ = false; |
558 } | 558 } |
559 | 559 |
560 void StartPageService::FetchDoodleJson() { | 560 void StartPageService::FetchDoodleJson() { |
561 // SetPathStr() requires its argument to stay in scope as long as | |
562 // |replacements| is, so a std::string is needed, instead of a char*. | |
563 std::string path = kDoodleJsonPath; | |
564 GURL::Replacements replacements; | 561 GURL::Replacements replacements; |
565 replacements.SetPathStr(path); | 562 replacements.SetPathStr(kDoodleJsonPath); |
566 | 563 |
567 GURL google_base_url(UIThreadSearchTermsData(profile_).GoogleBaseURLValue()); | 564 GURL google_base_url(UIThreadSearchTermsData(profile_).GoogleBaseURLValue()); |
568 GURL doodle_url = google_base_url.ReplaceComponents(replacements); | 565 GURL doodle_url = google_base_url.ReplaceComponents(replacements); |
569 doodle_fetcher_.reset( | 566 doodle_fetcher_.reset( |
570 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this)); | 567 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this)); |
571 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); | 568 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); |
572 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 569 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
573 doodle_fetcher_->Start(); | 570 doodle_fetcher_->Start(); |
574 } | 571 } |
575 | 572 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 607 |
611 // Check for a new doodle. | 608 // Check for a new doodle. |
612 content::BrowserThread::PostDelayedTask( | 609 content::BrowserThread::PostDelayedTask( |
613 content::BrowserThread::UI, FROM_HERE, | 610 content::BrowserThread::UI, FROM_HERE, |
614 base::Bind(&StartPageService::FetchDoodleJson, | 611 base::Bind(&StartPageService::FetchDoodleJson, |
615 weak_factory_.GetWeakPtr()), | 612 weak_factory_.GetWeakPtr()), |
616 recheck_delay); | 613 recheck_delay); |
617 } | 614 } |
618 | 615 |
619 } // namespace app_list | 616 } // namespace app_list |
OLD | NEW |