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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc

Issue 1330443002: Report data usage UMA for Chrome services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewArchServices
Patch Set: Fix calling Init function in sync_client.cc Created 5 years, 3 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 (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/spellchecker/spellcheck_hunspell_dictionary.h" 5 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "chrome/browser/spellchecker/spellcheck_platform.h" 11 #include "chrome/browser/spellchecker/spellcheck_platform.h"
12 #include "chrome/browser/spellchecker/spellcheck_service.h" 12 #include "chrome/browser/spellchecker/spellcheck_service.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/spellcheck_common.h" 14 #include "chrome/common/spellcheck_common.h"
15 #include "components/data_use_measurement/core/data_use_user_data.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
17 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
18 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 #if !defined(OS_ANDROID) 23 #if !defined(OS_ANDROID)
23 #include "base/files/memory_mapped_file.h" 24 #include "base/files/memory_mapped_file.h"
24 #include "third_party/hunspell/google/bdict.h" 25 #include "third_party/hunspell/google/bdict.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 238
238 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { 239 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) {
239 DCHECK_CURRENTLY_ON(BrowserThread::UI); 240 DCHECK_CURRENTLY_ON(BrowserThread::UI);
240 DCHECK(request_context_getter_); 241 DCHECK(request_context_getter_);
241 242
242 download_status_ = DOWNLOAD_IN_PROGRESS; 243 download_status_ = DOWNLOAD_IN_PROGRESS;
243 FOR_EACH_OBSERVER(Observer, observers_, 244 FOR_EACH_OBSERVER(Observer, observers_,
244 OnHunspellDictionaryDownloadBegin(language_)); 245 OnHunspellDictionaryDownloadBegin(language_));
245 246
246 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); 247 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this);
248 data_use_measurement::DataUseUserData::AttachToFetcher(
249 fetcher_.get(), data_use_measurement::DataUseUserData::SPELL_CHECKER);
247 fetcher_->SetRequestContext(request_context_getter_); 250 fetcher_->SetRequestContext(request_context_getter_);
248 fetcher_->SetLoadFlags( 251 fetcher_->SetLoadFlags(
249 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 252 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
250 fetcher_->Start(); 253 fetcher_->Start();
251 // Attempt downloading the dictionary only once. 254 // Attempt downloading the dictionary only once.
252 request_context_getter_ = NULL; 255 request_context_getter_ = NULL;
253 } 256 }
254 257
255 // The default_dictionary_file can either come from the standard list of 258 // The default_dictionary_file can either come from the standard list of
256 // hunspell dictionaries (determined in InitializeDictionaryLocation), or it 259 // hunspell dictionaries (determined in InitializeDictionaryLocation), or it
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 FOR_EACH_OBSERVER(Observer, observers_, 368 FOR_EACH_OBSERVER(Observer, observers_,
366 OnHunspellDictionaryInitialized(language_)); 369 OnHunspellDictionaryInitialized(language_));
367 } 370 }
368 371
369 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { 372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() {
370 download_status_ = DOWNLOAD_FAILED; 373 download_status_ = DOWNLOAD_FAILED;
371 FOR_EACH_OBSERVER(Observer, 374 FOR_EACH_OBSERVER(Observer,
372 observers_, 375 observers_,
373 OnHunspellDictionaryDownloadFailure(language_)); 376 OnHunspellDictionaryDownloadFailure(language_));
374 } 377 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/feedback_sender.cc ('k') | chrome/browser/spellchecker/spelling_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698