| Index: components/ntp_snippets/ntp_snippets_fetcher.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| index 7c74fcfe7e5f2c65b44061d4af0eab9e98be78e6..289b8f3be81e65656f06ada6a74125a56781ea16 100644
|
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| @@ -66,27 +66,7 @@ NTPSnippetsFetcher::AddCallback(const SnippetsAvailableCallback& callback) {
|
| return callback_list_.Add(callback);
|
| }
|
|
|
| -void NTPSnippetsFetcher::FetchSnippets(bool overwrite) {
|
| - if (overwrite) {
|
| - StartFetch();
|
| - } else {
|
| - base::PostTaskAndReplyWithResult(
|
| - file_task_runner_.get(), FROM_HERE,
|
| - base::Bind(&base::PathExists, download_path_),
|
| - base::Bind(&NTPSnippetsFetcher::OnFileExistsCheckDone,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| - }
|
| -}
|
| -
|
| -void NTPSnippetsFetcher::OnFileExistsCheckDone(bool exists) {
|
| - if (exists) {
|
| - NotifyObservers();
|
| - } else {
|
| - StartFetch();
|
| - }
|
| -}
|
| -
|
| -void NTPSnippetsFetcher::StartFetch() {
|
| +void NTPSnippetsFetcher::FetchSnippets() {
|
| if (signin_manager_->IsAuthenticated()) {
|
| StartTokenRequest();
|
| } else {
|
| @@ -105,6 +85,16 @@ void NTPSnippetsFetcher::StartTokenRequest() {
|
| signin_manager_->GetAuthenticatedAccountId(), scopes, this);
|
| }
|
|
|
| +void NTPSnippetsFetcher::OnFileMoveDone(bool success) {
|
| + if (!success) {
|
| + DLOG(WARNING) << "Could not move file to "
|
| + << download_path_.LossyDisplayName();
|
| + return;
|
| + }
|
| +
|
| + NotifyObservers();
|
| +}
|
| +
|
| void NTPSnippetsFetcher::NotifyObservers() {
|
| callback_list_.Notify(download_path_);
|
| }
|
| @@ -178,14 +168,4 @@ void NTPSnippetsFetcher::OnURLFetchComplete(const URLFetcher* source) {
|
| weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void NTPSnippetsFetcher::OnFileMoveDone(bool success) {
|
| - if (!success) {
|
| - DLOG(WARNING) << "Could not move file to "
|
| - << download_path_.LossyDisplayName();
|
| - return;
|
| - }
|
| -
|
| - NotifyObservers();
|
| -}
|
| -
|
| } // namespace ntp_snippets
|
|
|