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

Side by Side Diff: ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.mm

Issue 2913573002: Updates language model on iOS. (Closed)
Patch Set: Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h" 5 #include "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/metrics/user_metrics.h" 16 #include "base/metrics/user_metrics.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "components/autofill/core/browser/personal_data_manager.h" 18 #include "components/autofill/core/browser/personal_data_manager.h"
19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
20 #include "components/history/core/browser/history_service.h" 20 #include "components/history/core/browser/history_service.h"
21 #include "components/keyed_service/core/service_access_type.h" 21 #include "components/keyed_service/core/service_access_type.h"
22 #include "components/omnibox/browser/omnibox_pref_names.h" 22 #include "components/omnibox/browser/omnibox_pref_names.h"
23 #include "components/password_manager/core/browser/password_store.h" 23 #include "components/password_manager/core/browser/password_store.h"
24 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
25 #include "components/search_engines/template_url_service.h" 25 #include "components/search_engines/template_url_service.h"
26 #include "components/sessions/core/tab_restore_service.h" 26 #include "components/sessions/core/tab_restore_service.h"
27 #include "components/translate/core/browser/language_model.h"
27 #include "ios/chrome/browser/application_context.h" 28 #include "ios/chrome/browser/application_context.h"
28 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" 29 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
29 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
30 #include "ios/chrome/browser/history/history_service_factory.h" 31 #include "ios/chrome/browser/history/history_service_factory.h"
31 #include "ios/chrome/browser/history/web_history_service_factory.h" 32 #include "ios/chrome/browser/history/web_history_service_factory.h"
32 #include "ios/chrome/browser/ios_chrome_io_thread.h" 33 #include "ios/chrome/browser/ios_chrome_io_thread.h"
33 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" 34 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
34 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 35 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
35 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" 36 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
37 #include "ios/chrome/browser/translate/language_model_factory.h"
36 #include "ios/chrome/browser/web_data_service_factory.h" 38 #include "ios/chrome/browser/web_data_service_factory.h"
37 #include "ios/net/http_cache_helper.h" 39 #include "ios/net/http_cache_helper.h"
38 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 40 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
39 #include "ios/web/public/web_thread.h" 41 #include "ios/web/public/web_thread.h"
40 #include "net/base/net_errors.h" 42 #include "net/base/net_errors.h"
41 #include "net/cookies/cookie_store.h" 43 #include "net/cookies/cookie_store.h"
42 #include "net/http/transport_security_state.h" 44 #include "net/http/transport_security_state.h"
43 #include "net/ssl/channel_id_service.h" 45 #include "net/ssl/channel_id_service.h"
44 #include "net/ssl/channel_id_store.h" 46 #include "net/ssl/channel_id_store.h"
45 #include "net/url_request/url_request_context.h" 47 #include "net/url_request/url_request_context.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; 345 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE;
344 if (remove_mask & REMOVE_COOKIES) { 346 if (remove_mask & REMOVE_COOKIES) {
345 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE : ONLY_COOKIES; 347 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE : ONLY_COOKIES;
346 } else if (remove_mask & REMOVE_CACHE) { 348 } else if (remove_mask & REMOVE_CACHE) {
347 choice = ONLY_CACHE; 349 choice = ONLY_CACHE;
348 } 350 }
349 351
350 UMA_HISTOGRAM_ENUMERATION( 352 UMA_HISTOGRAM_ENUMERATION(
351 "History.ClearBrowsingData.UserDeletedCookieOrCache", choice, 353 "History.ClearBrowsingData.UserDeletedCookieOrCache", choice,
352 MAX_CHOICE_VALUE); 354 MAX_CHOICE_VALUE);
355
356 // Remove language model history.
martis 2017/06/01 06:49:21 I believe the language model should only be cleare
ramyasharma 2017/06/02 07:20:24 Thanks, good catch.
357 translate::LanguageModel* language_model =
358 translate::LanguageModelFactory::GetForBrowserState(browser_state_);
359 if (language_model) {
360 language_model->ClearHistory(delete_begin_, delete_end_);
361 }
353 } 362 }
354 363
355 void IOSChromeBrowsingDataRemover::AddObserver(Observer* observer) { 364 void IOSChromeBrowsingDataRemover::AddObserver(Observer* observer) {
356 observer_list_.AddObserver(observer); 365 observer_list_.AddObserver(observer);
357 } 366 }
358 367
359 void IOSChromeBrowsingDataRemover::RemoveObserver(Observer* observer) { 368 void IOSChromeBrowsingDataRemover::RemoveObserver(Observer* observer) {
360 observer_list_.RemoveObserver(observer); 369 observer_list_.RemoveObserver(observer);
361 } 370 }
362 371
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 waiting_for_clear_autofill_origin_urls_ = false; 516 waiting_for_clear_autofill_origin_urls_ = false;
508 NotifyAndDeleteIfDone(); 517 NotifyAndDeleteIfDone();
509 } 518 }
510 519
511 // static 520 // static
512 IOSChromeBrowsingDataRemover::CallbackSubscription 521 IOSChromeBrowsingDataRemover::CallbackSubscription
513 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( 522 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
514 const IOSChromeBrowsingDataRemover::Callback& callback) { 523 const IOSChromeBrowsingDataRemover::Callback& callback) {
515 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); 524 return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
516 } 525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698