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

Side by Side Diff: chrome/browser/views/tab_contents/render_view_context_menu_win.cc

Issue 150171: Convert menu strings to UTF16, fix some views-GTK build errors. (Closed)
Patch Set: Created 11 years, 5 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) 2009 The Chromium Authors. All rights reserved. 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 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/views/tab_contents/render_view_context_menu_win.h" 5 #include "chrome/browser/views/tab_contents/render_view_context_menu_win.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void RenderViewContextMenuWin::DoInit() { 84 void RenderViewContextMenuWin::DoInit() {
85 menu_.reset(new views::Menu2(menu_contents_.get())); 85 menu_.reset(new views::Menu2(menu_contents_.get()));
86 } 86 }
87 87
88 void RenderViewContextMenuWin::AppendMenuItem(int id) { 88 void RenderViewContextMenuWin::AppendMenuItem(int id) {
89 current_radio_group_id_ = -1; 89 current_radio_group_id_ = -1;
90 GetTargetModel()->AddItemWithStringId(id, id); 90 GetTargetModel()->AddItemWithStringId(id, id);
91 } 91 }
92 92
93 void RenderViewContextMenuWin::AppendMenuItem(int id, 93 void RenderViewContextMenuWin::AppendMenuItem(int id,
94 const std::wstring& label) { 94 const string16& label) {
95 current_radio_group_id_ = -1; 95 current_radio_group_id_ = -1;
96 GetTargetModel()->AddItem(id, label); 96 GetTargetModel()->AddItem(id, label);
97 } 97 }
98 98
99 void RenderViewContextMenuWin::AppendRadioMenuItem(int id, 99 void RenderViewContextMenuWin::AppendRadioMenuItem(int id,
100 const std::wstring& label) { 100 const string16& label) {
101 if (current_radio_group_id_ < 0) 101 if (current_radio_group_id_ < 0)
102 current_radio_group_id_ = id; 102 current_radio_group_id_ = id;
103 GetTargetModel()->AddRadioItem(id, label, current_radio_group_id_); 103 GetTargetModel()->AddRadioItem(id, label, current_radio_group_id_);
104 } 104 }
105 105
106 void RenderViewContextMenuWin::AppendCheckboxMenuItem( 106 void RenderViewContextMenuWin::AppendCheckboxMenuItem(int id,
107 int id, 107 const string16& label) {
108 const std::wstring& label) {
109 current_radio_group_id_ = -1; 108 current_radio_group_id_ = -1;
110 GetTargetModel()->AddCheckItem(id, label); 109 GetTargetModel()->AddCheckItem(id, label);
111 } 110 }
112 111
113 void RenderViewContextMenuWin::AppendSeparator() { 112 void RenderViewContextMenuWin::AppendSeparator() {
114 current_radio_group_id_ = -1; 113 current_radio_group_id_ = -1;
115 GetTargetModel()->AddSeparator(); 114 GetTargetModel()->AddSeparator();
116 } 115 }
117 116
118 void RenderViewContextMenuWin::StartSubMenu(int id, const std::wstring& label) { 117 void RenderViewContextMenuWin::StartSubMenu(int id, const string16& label) {
119 if (sub_menu_contents_) { 118 if (sub_menu_contents_) {
120 NOTREACHED() << "nested submenus not supported yet"; 119 NOTREACHED() << "nested submenus not supported yet";
121 return; 120 return;
122 } 121 }
123 current_radio_group_id_ = -1; 122 current_radio_group_id_ = -1;
124 sub_menu_contents_ = new views::SimpleMenuModel(this); 123 sub_menu_contents_ = new views::SimpleMenuModel(this);
125 menu_contents_->AddSubMenu(label, sub_menu_contents_); 124 menu_contents_->AddSubMenu(label, sub_menu_contents_);
126 submenu_models_.push_back(sub_menu_contents_); 125 submenu_models_.push_back(sub_menu_contents_);
127 } 126 }
128 127
129 void RenderViewContextMenuWin::FinishSubMenu() { 128 void RenderViewContextMenuWin::FinishSubMenu() {
130 DCHECK(sub_menu_contents_); 129 DCHECK(sub_menu_contents_);
131 current_radio_group_id_ = -1; 130 current_radio_group_id_ = -1;
132 sub_menu_contents_ = NULL; 131 sub_menu_contents_ = NULL;
133 } 132 }
134 133
135 //////////////////////////////////////////////////////////////////////////////// 134 ////////////////////////////////////////////////////////////////////////////////
136 // RenderViewContextMenuWin, private: 135 // RenderViewContextMenuWin, private:
137 136
138 views::SimpleMenuModel* RenderViewContextMenuWin::GetTargetModel() const { 137 views::SimpleMenuModel* RenderViewContextMenuWin::GetTargetModel() const {
139 return sub_menu_contents_ ? sub_menu_contents_ : menu_contents_.get(); 138 return sub_menu_contents_ ? sub_menu_contents_ : menu_contents_.get();
140 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698