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

Side by Side Diff: ios/chrome/browser/ui/settings/translate_collection_view_controller.mm

Issue 2724233003: Adding haptics for more HUD uses. (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ios/chrome/browser/ui/settings/translate_collection_view_controller.h" 5 #import "ios/chrome/browser/ui/settings/translate_collection_view_controller.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "components/google/core/browser/google_util.h" 12 #include "components/google/core/browser/google_util.h"
13 #include "components/prefs/pref_member.h" 13 #include "components/prefs/pref_member.h"
14 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
15 #include "components/translate/core/browser/translate_prefs.h" 15 #include "components/translate/core/browser/translate_prefs.h"
16 #include "components/translate/core/common/translate_pref_names.h" 16 #include "components/translate/core/common/translate_pref_names.h"
17 #include "ios/chrome/browser/application_context.h" 17 #include "ios/chrome/browser/application_context.h"
18 #import "ios/chrome/browser/translate/chrome_ios_translate_client.h" 18 #import "ios/chrome/browser/translate/chrome_ios_translate_client.h"
19 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" 19 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h"
20 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h" 20 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h"
21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h" 21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h"
22 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h " 22 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h "
23 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 23 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
24 #import "ios/chrome/browser/ui/settings/settings_utils.h" 24 #import "ios/chrome/browser/ui/settings/settings_utils.h"
25 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" 25 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h"
26 #include "ios/chrome/browser/ui/uikit_ui_util.h"
26 #include "ios/chrome/grit/ios_chromium_strings.h" 27 #include "ios/chrome/grit/ios_chromium_strings.h"
27 #include "ios/chrome/grit/ios_strings.h" 28 #include "ios/chrome/grit/ios_strings.h"
28 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 29 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
29 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h" 30 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h"
30 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 31 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h"
31 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
32 #include "url/gurl.h" 33 #include "url/gurl.h"
33 34
34 namespace { 35 namespace {
35 36
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 159 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
159 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; 160 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
160 161
161 NSInteger itemType = 162 NSInteger itemType =
162 [self.collectionViewModel itemTypeForIndexPath:indexPath]; 163 [self.collectionViewModel itemTypeForIndexPath:indexPath];
163 164
164 if (itemType == ItemTypeResetTranslate) { 165 if (itemType == ItemTypeResetTranslate) {
165 std::unique_ptr<translate::TranslatePrefs> translatePrefs( 166 std::unique_ptr<translate::TranslatePrefs> translatePrefs(
166 ChromeIOSTranslateClient::CreateTranslatePrefs(_prefs)); 167 ChromeIOSTranslateClient::CreateTranslatePrefs(_prefs));
167 translatePrefs->ResetToDefaults(); 168 translatePrefs->ResetToDefaults();
169 TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess);
168 NSString* messageText = 170 NSString* messageText =
169 l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_RESET_NOTIFICATION); 171 l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_RESET_NOTIFICATION);
170 MDCSnackbarMessage* message = 172 MDCSnackbarMessage* message =
171 [MDCSnackbarMessage messageWithText:messageText]; 173 [MDCSnackbarMessage messageWithText:messageText];
172 message.category = kTranslateSettingsCategory; 174 message.category = kTranslateSettingsCategory;
173 [MDCSnackbarManager showMessage:message]; 175 [MDCSnackbarManager showMessage:message];
174 } 176 }
175 } 177 }
176 178
177 #pragma mark MDCCollectionViewStylingDelegate 179 #pragma mark MDCCollectionViewStylingDelegate
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 base::mac::ObjCCastStrict<CollectionViewSwitchCell>( 253 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(
252 [self.collectionView cellForItemAtIndexPath:switchPath]); 254 [self.collectionView cellForItemAtIndexPath:switchPath]);
253 255
254 DCHECK_EQ(switchCell.switchView, sender); 256 DCHECK_EQ(switchCell.switchView, sender);
255 BOOL isOn = switchCell.switchView.isOn; 257 BOOL isOn = switchCell.switchView.isOn;
256 switchItem.on = isOn; 258 switchItem.on = isOn;
257 [_translationEnabled setValue:isOn]; 259 [_translationEnabled setValue:isOn];
258 } 260 }
259 261
260 @end 262 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698