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

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

Issue 1339943003: Revert "Report data usage UMA for Chrome services" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
18 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
19 #include "net/url_request/url_fetcher.h" 18 #include "net/url_request/url_fetcher.h"
20 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
21 #include "url/gurl.h" 20 #include "url/gurl.h"
22 21
23 #if !defined(OS_ANDROID) 22 #if !defined(OS_ANDROID)
24 #include "base/files/memory_mapped_file.h" 23 #include "base/files/memory_mapped_file.h"
25 #include "third_party/hunspell/google/bdict.h" 24 #include "third_party/hunspell/google/bdict.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 237
239 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { 238 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) {
240 DCHECK_CURRENTLY_ON(BrowserThread::UI); 239 DCHECK_CURRENTLY_ON(BrowserThread::UI);
241 DCHECK(request_context_getter_); 240 DCHECK(request_context_getter_);
242 241
243 download_status_ = DOWNLOAD_IN_PROGRESS; 242 download_status_ = DOWNLOAD_IN_PROGRESS;
244 FOR_EACH_OBSERVER(Observer, observers_, 243 FOR_EACH_OBSERVER(Observer, observers_,
245 OnHunspellDictionaryDownloadBegin(language_)); 244 OnHunspellDictionaryDownloadBegin(language_));
246 245
247 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); 246 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this);
248 data_use_measurement::DataUseUserData::AttachToFetcher(
249 fetcher_.get(), data_use_measurement::DataUseUserData::SPELL_CHECKER);
250 fetcher_->SetRequestContext(request_context_getter_); 247 fetcher_->SetRequestContext(request_context_getter_);
251 fetcher_->SetLoadFlags( 248 fetcher_->SetLoadFlags(
252 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 249 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
253 fetcher_->Start(); 250 fetcher_->Start();
254 // Attempt downloading the dictionary only once. 251 // Attempt downloading the dictionary only once.
255 request_context_getter_ = NULL; 252 request_context_getter_ = NULL;
256 } 253 }
257 254
258 // The default_dictionary_file can either come from the standard list of 255 // The default_dictionary_file can either come from the standard list of
259 // hunspell dictionaries (determined in InitializeDictionaryLocation), or it 256 // hunspell dictionaries (determined in InitializeDictionaryLocation), or it
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 FOR_EACH_OBSERVER(Observer, observers_, 365 FOR_EACH_OBSERVER(Observer, observers_,
369 OnHunspellDictionaryInitialized(language_)); 366 OnHunspellDictionaryInitialized(language_));
370 } 367 }
371 368
372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { 369 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() {
373 download_status_ = DOWNLOAD_FAILED; 370 download_status_ = DOWNLOAD_FAILED;
374 FOR_EACH_OBSERVER(Observer, 371 FOR_EACH_OBSERVER(Observer,
375 observers_, 372 observers_,
376 OnHunspellDictionaryDownloadFailure(language_)); 373 OnHunspellDictionaryDownloadFailure(language_));
377 } 374 }
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