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

Side by Side Diff: chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.mm

Issue 2254273003: Remove text encoding UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 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
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/strings/string16.h"
10 #include "base/strings/sys_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
14
15 namespace {
16
17 void AddSeparatorToMenu(NSMenu *parent_menu) {
18 NSMenuItem* separator = [NSMenuItem separatorItem];
19 [parent_menu addItem:separator];
20 }
21
22 void AppendMenuItem(NSMenu *parent_menu, int tag, NSString *title) {
23
24 NSMenuItem* item = [[[NSMenuItem alloc] initWithTitle:title
25 action:nil
26 keyEquivalent:@""] autorelease];
27 [parent_menu addItem:item];
28 [item setAction:@selector(commandDispatch:)];
29 [item setTag:tag];
30 }
31
32 } // namespace
33
34 // static
35 void EncodingMenuControllerDelegate::BuildEncodingMenu(Profile *profile,
36 NSMenu* encoding_menu) {
37 DCHECK(profile);
38
39 typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList;
40 EncodingMenuItemList menuItems;
41 EncodingMenuController controller;
42 controller.GetEncodingMenuItems(profile, &menuItems);
43
44 for (EncodingMenuItemList::iterator it = menuItems.begin();
45 it != menuItems.end();
46 ++it) {
47 int item_id = it->first;
48 base::string16 &localized_title_string16 = it->second;
49
50 if (item_id == 0) {
51 AddSeparatorToMenu(encoding_menu);
52 } else {
53 NSString *localized_title =
54 base::SysUTF16ToNSString(localized_title_string16);
55 AppendMenuItem(encoding_menu, item_id, localized_title);
56 }
57 }
58
59 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698