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

Side by Side Diff: chrome/browser/wrench_menu_model.cc

Issue 5544002: Move a bunch more browser stuff around.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/wrench_menu_model.h ('k') | chrome/browser/wrench_menu_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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/wrench_menu_model.h"
6
7 #include <algorithm>
8 #include <cmath>
9
10 #include "app/l10n_util.h"
11 #include "app/menus/button_menu_item_model.h"
12 #include "app/resource_bundle.h"
13 #include "base/command_line.h"
14 #include "base/i18n/number_formatting.h"
15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h"
17 #include "base/utf_string_conversions.h"
18 #include "chrome/app/chrome_command_ids.h"
19 #include "chrome/browser/background_page_tracker.h"
20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/encoding_menu_controller.h"
23 #include "chrome/browser/profile.h"
24 #include "chrome/browser/prefs/pref_service.h"
25 #include "chrome/browser/sync/profile_sync_service.h"
26 #include "chrome/browser/sync/sync_ui_util.h"
27 #include "chrome/browser/tab_contents/tab_contents.h"
28 #include "chrome/browser/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/upgrade_detector.h"
31 #include "chrome/common/badge_util.h"
32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/notification_service.h"
34 #include "chrome/common/notification_source.h"
35 #include "chrome/common/notification_type.h"
36 #include "chrome/common/pref_names.h"
37 #include "grit/chromium_strings.h"
38 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h"
40
41 #if defined(OS_LINUX)
42 #include <gtk/gtk.h>
43 #include "chrome/browser/gtk/gtk_util.h"
44 #endif
45
46 #if defined(OS_MACOSX)
47 #include "chrome/browser/browser_window.h"
48 #endif
49
50 #if defined(OS_CHROMEOS)
51 #include "chrome/browser/chromeos/cros/cros_library.h"
52 #include "chrome/browser/chromeos/cros/update_library.h"
53 #endif
54
55 #if defined(OS_WIN)
56 #include "chrome/browser/enumerate_modules_model_win.h"
57 #endif
58
59 // The size of the font used for dynamic text overlays on menu items.
60 const float kMenuBadgeFontSize = 12.0;
61
62 namespace {
63 SkBitmap GetBackgroundPageIcon() {
64 string16 pages = base::FormatNumber(
65 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount());
66 return badge_util::DrawBadgeIconOverlay(
67 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_BACKGROUND_MENU),
68 kMenuBadgeFontSize,
69 pages,
70 l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW));
71 }
72
73 } // namespace
74
75 ////////////////////////////////////////////////////////////////////////////////
76 // EncodingMenuModel
77
78 EncodingMenuModel::EncodingMenuModel(Browser* browser)
79 : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
80 browser_(browser) {
81 Build();
82 }
83
84 EncodingMenuModel::~EncodingMenuModel() {
85 }
86
87 void EncodingMenuModel::Build() {
88 EncodingMenuController::EncodingMenuItemList encoding_menu_items;
89 EncodingMenuController encoding_menu_controller;
90 encoding_menu_controller.GetEncodingMenuItems(browser_->profile(),
91 &encoding_menu_items);
92
93 int group_id = 0;
94 EncodingMenuController::EncodingMenuItemList::iterator it =
95 encoding_menu_items.begin();
96 for (; it != encoding_menu_items.end(); ++it) {
97 int id = it->first;
98 string16& label = it->second;
99 if (id == 0) {
100 AddSeparator();
101 } else {
102 if (id == IDC_ENCODING_AUTO_DETECT) {
103 AddCheckItem(id, label);
104 } else {
105 // Use the id of the first radio command as the id of the group.
106 if (group_id <= 0)
107 group_id = id;
108 AddRadioItem(id, label, group_id);
109 }
110 }
111 }
112 }
113
114 bool EncodingMenuModel::IsCommandIdChecked(int command_id) const {
115 TabContents* current_tab = browser_->GetSelectedTabContents();
116 if (!current_tab)
117 return false;
118 EncodingMenuController controller;
119 return controller.IsItemChecked(browser_->profile(),
120 current_tab->encoding(), command_id);
121 }
122
123 bool EncodingMenuModel::IsCommandIdEnabled(int command_id) const {
124 bool enabled = browser_->command_updater()->IsCommandEnabled(command_id);
125 // Special handling for the contents of the Encoding submenu. On Mac OS,
126 // instead of enabling/disabling the top-level menu item, the submenu's
127 // contents get disabled, per Apple's HIG.
128 #if defined(OS_MACOSX)
129 enabled &= browser_->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU);
130 #endif
131 return enabled;
132 }
133
134 bool EncodingMenuModel::GetAcceleratorForCommandId(
135 int command_id,
136 menus::Accelerator* accelerator) {
137 return false;
138 }
139
140 void EncodingMenuModel::ExecuteCommand(int command_id) {
141 browser_->ExecuteCommand(command_id);
142 }
143
144 ////////////////////////////////////////////////////////////////////////////////
145 // ZoomMenuModel
146
147 ZoomMenuModel::ZoomMenuModel(menus::SimpleMenuModel::Delegate* delegate)
148 : SimpleMenuModel(delegate) {
149 Build();
150 }
151
152 ZoomMenuModel::~ZoomMenuModel() {
153 }
154
155 void ZoomMenuModel::Build() {
156 AddItemWithStringId(IDC_ZOOM_PLUS, IDS_ZOOM_PLUS);
157 AddItemWithStringId(IDC_ZOOM_NORMAL, IDS_ZOOM_NORMAL);
158 AddItemWithStringId(IDC_ZOOM_MINUS, IDS_ZOOM_MINUS);
159 }
160
161 ////////////////////////////////////////////////////////////////////////////////
162 // ToolsMenuModel
163
164 ToolsMenuModel::ToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate,
165 Browser* browser)
166 : SimpleMenuModel(delegate) {
167 Build(browser);
168 }
169
170 ToolsMenuModel::~ToolsMenuModel() {}
171
172 void ToolsMenuModel::Build(Browser* browser) {
173 AddCheckItemWithStringId(IDC_SHOW_BOOKMARK_BAR, IDS_SHOW_BOOKMARK_BAR);
174
175 AddSeparator();
176
177 #if !defined(OS_CHROMEOS)
178 #if defined(OS_MACOSX)
179 AddItemWithStringId(IDC_CREATE_SHORTCUTS, IDS_CREATE_APPLICATION_MAC);
180 #else
181 AddItemWithStringId(IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS);
182 #endif
183 AddSeparator();
184 #endif
185
186 AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS);
187 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
188 AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA);
189
190 AddSeparator();
191 #if defined(OS_CHROMEOS)
192 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK);
193 AddSeparator();
194 #endif
195
196 encoding_menu_model_.reset(new EncodingMenuModel(browser));
197 AddSubMenuWithStringId(IDC_ENCODING_MENU, IDS_ENCODING_MENU,
198 encoding_menu_model_.get());
199 AddItemWithStringId(IDC_VIEW_SOURCE, IDS_VIEW_SOURCE);
200 if (g_browser_process->have_inspector_files()) {
201 AddItemWithStringId(IDC_DEV_TOOLS, IDS_DEV_TOOLS);
202 AddItemWithStringId(IDC_DEV_TOOLS_CONSOLE, IDS_DEV_TOOLS_CONSOLE);
203 }
204 }
205
206 ////////////////////////////////////////////////////////////////////////////////
207 // WrenchMenuModel
208
209 WrenchMenuModel::WrenchMenuModel(menus::AcceleratorProvider* provider,
210 Browser* browser)
211 : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
212 provider_(provider),
213 browser_(browser),
214 tabstrip_model_(browser_->tabstrip_model()) {
215 Build();
216 UpdateZoomControls();
217
218 tabstrip_model_->AddObserver(this);
219
220 registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED,
221 Source<Profile>(browser_->profile()));
222 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
223 NotificationService::AllSources());
224 registrar_.Add(this,
225 NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED,
226 NotificationService::AllSources());
227 }
228
229 WrenchMenuModel::~WrenchMenuModel() {
230 if (tabstrip_model_)
231 tabstrip_model_->RemoveObserver(this);
232 }
233
234 bool WrenchMenuModel::DoesCommandIdDismissMenu(int command_id) const {
235 return command_id != IDC_ZOOM_MINUS && command_id != IDC_ZOOM_PLUS;
236 }
237
238 bool WrenchMenuModel::IsLabelForCommandIdDynamic(int command_id) const {
239 return command_id == IDC_ZOOM_PERCENT_DISPLAY ||
240 #if defined(OS_MACOSX)
241 command_id == IDC_FULLSCREEN ||
242 #endif
243 command_id == IDC_SYNC_BOOKMARKS ||
244 command_id == IDC_VIEW_BACKGROUND_PAGES;
245 }
246
247 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
248 switch (command_id) {
249 case IDC_SYNC_BOOKMARKS:
250 return GetSyncMenuLabel();
251 case IDC_ZOOM_PERCENT_DISPLAY:
252 return zoom_label_;
253 #if defined(OS_MACOSX)
254 case IDC_FULLSCREEN: {
255 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter.
256 // Note: On startup, |window()| may be NULL.
257 if (browser_->window() && browser_->window()->IsFullscreen())
258 string_id = IDS_EXIT_FULLSCREEN_MAC;
259 return l10n_util::GetStringUTF16(string_id);
260 }
261 #endif
262 case IDC_VIEW_BACKGROUND_PAGES: {
263 string16 num_background_pages = base::FormatNumber(
264 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount());
265 return l10n_util::GetStringFUTF16(IDS_VIEW_BACKGROUND_PAGES,
266 num_background_pages);
267 }
268 default:
269 NOTREACHED();
270 return string16();
271 }
272 }
273
274 void WrenchMenuModel::ExecuteCommand(int command_id) {
275 browser_->ExecuteCommand(command_id);
276 }
277
278 bool WrenchMenuModel::IsCommandIdChecked(int command_id) const {
279 if (command_id == IDC_SHOW_BOOKMARK_BAR) {
280 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
281 }
282
283 return false;
284 }
285
286 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const {
287 #if defined(OS_CHROMEOS)
288 // Special case because IDC_NEW_WINDOW item should be disabled in BWSI mode,
289 // but accelerator should work.
290 if (command_id == IDC_NEW_WINDOW &&
291 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession))
292 return false;
293 #endif
294
295 return browser_->command_updater()->IsCommandEnabled(command_id);
296 }
297
298 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const {
299 if (command_id == IDC_UPGRADE_DIALOG) {
300 #if defined(OS_CHROMEOS)
301 return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status
302 == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT);
303 #else
304 return Singleton<UpgradeDetector>::get()->notify_upgrade();
305 #endif
306 } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) {
307 #if defined(OS_WIN)
308 EnumerateModulesModel* loaded_modules =
309 EnumerateModulesModel::GetSingleton();
310 return loaded_modules->confirmed_bad_modules_detected() > 0;
311 #else
312 return false;
313 #endif
314 } else if (command_id == IDC_VIEW_BACKGROUND_PAGES) {
315 BackgroundPageTracker* tracker = BackgroundPageTracker::GetSingleton();
316 return tracker->GetBackgroundPageCount() > 0;
317 }
318 return true;
319 }
320
321 bool WrenchMenuModel::GetAcceleratorForCommandId(
322 int command_id,
323 menus::Accelerator* accelerator) {
324 return provider_->GetAcceleratorForCommandId(command_id, accelerator);
325 }
326
327 void WrenchMenuModel::TabSelectedAt(TabContentsWrapper* old_contents,
328 TabContentsWrapper* new_contents,
329 int index,
330 bool user_gesture) {
331 // The user has switched between tabs and the new tab may have a different
332 // zoom setting.
333 UpdateZoomControls();
334 }
335
336 void WrenchMenuModel::TabReplacedAt(TabContentsWrapper* old_contents,
337 TabContentsWrapper* new_contents,
338 int index) {
339 UpdateZoomControls();
340 }
341
342 void WrenchMenuModel::TabStripModelDeleted() {
343 // During views shutdown, the tabstrip model/browser is deleted first, while
344 // it is the opposite in gtk land.
345 tabstrip_model_->RemoveObserver(this);
346 tabstrip_model_ = NULL;
347 }
348
349 void WrenchMenuModel::Observe(NotificationType type,
350 const NotificationSource& source,
351 const NotificationDetails& details) {
352 switch (type.value) {
353 case NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED: {
354 int num_pages = BackgroundPageTracker::GetSingleton()->
355 GetUnacknowledgedBackgroundPageCount();
356 if (num_pages > 0) {
357 SetIcon(GetIndexOfCommandId(IDC_VIEW_BACKGROUND_PAGES),
358 GetBackgroundPageIcon());
359 } else {
360 // Just set a blank icon (no icon).
361 SetIcon(GetIndexOfCommandId(IDC_VIEW_BACKGROUND_PAGES), SkBitmap());
362 }
363 break;
364 }
365 case NotificationType::ZOOM_LEVEL_CHANGED:
366 case NotificationType::NAV_ENTRY_COMMITTED:
367 UpdateZoomControls();
368 break;
369 default:
370 NOTREACHED();
371 }
372 }
373
374 // For testing.
375 WrenchMenuModel::WrenchMenuModel()
376 : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
377 provider_(NULL),
378 browser_(NULL),
379 tabstrip_model_(NULL) {
380 }
381
382 void WrenchMenuModel::Build() {
383 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
384 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW);
385 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW,
386 IDS_NEW_INCOGNITO_WINDOW);
387
388 AddSeparator();
389 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
390 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
391 // layout for this menu item in Toolbar.xib. It does, however, use the
392 // command_id value from AddButtonItem() to identify this special item.
393 edit_menu_item_model_.reset(new menus::ButtonMenuItemModel(IDS_EDIT, this));
394 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT);
395 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY);
396 edit_menu_item_model_->AddGroupItemWithStringId(IDC_PASTE, IDS_PASTE);
397 AddButtonItem(IDC_EDIT_MENU, edit_menu_item_model_.get());
398 #else
399 // TODO(port): Move to the above.
400 CreateCutCopyPaste();
401 #endif
402
403 AddSeparator();
404 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
405 // WARNING: See above comment.
406 zoom_menu_item_model_.reset(
407 new menus::ButtonMenuItemModel(IDS_ZOOM_MENU, this));
408 zoom_menu_item_model_->AddGroupItemWithStringId(
409 IDC_ZOOM_MINUS, IDS_ZOOM_MINUS2);
410 zoom_menu_item_model_->AddButtonLabel(IDC_ZOOM_PERCENT_DISPLAY,
411 IDS_ZOOM_PLUS2);
412 zoom_menu_item_model_->AddGroupItemWithStringId(
413 IDC_ZOOM_PLUS, IDS_ZOOM_PLUS2);
414 zoom_menu_item_model_->AddSpace();
415 zoom_menu_item_model_->AddItemWithImage(
416 IDC_FULLSCREEN, IDR_FULLSCREEN_MENU_BUTTON);
417 AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get());
418 #else
419 // TODO(port): Move to the above.
420 CreateZoomFullscreen();
421 #endif
422
423 AddSeparator();
424 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE);
425 AddItemWithStringId(IDC_FIND, IDS_FIND);
426 AddItemWithStringId(IDC_PRINT, IDS_PRINT);
427
428 tools_menu_model_.reset(new ToolsMenuModel(this, browser_));
429 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU,
430 tools_menu_model_.get());
431
432 AddSeparator();
433 #if defined(ENABLE_REMOTING)
434 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) {
435 AddItem(IDC_REMOTING_SETUP,
436 l10n_util::GetStringUTF16(IDS_REMOTING_SETUP_LABEL));
437 }
438 #endif
439 AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER);
440 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY);
441 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
442 AddSeparator();
443
444 #if defined(OS_CHROMEOS)
445 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);
446 #elif defined(OS_MACOSX)
447 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
448 #elif defined(OS_LINUX)
449 string16 preferences = gtk_util::GetStockPreferencesMenuLabel();
450 if (!preferences.empty())
451 AddItem(IDC_OPTIONS, preferences);
452 else
453 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
454 #else
455 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS);
456 #endif
457
458 #if defined(OS_CHROMEOS)
459 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME);
460 #else
461 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
462 #endif
463 // On Mac, there is no About item.
464 if (browser_defaults::kShowAboutMenuItem) {
465 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(
466 IDS_ABOUT, product_name));
467 }
468 string16 num_background_pages = base::FormatNumber(
469 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount());
470 AddItem(IDC_VIEW_BACKGROUND_PAGES, l10n_util::GetStringFUTF16(
471 IDS_VIEW_BACKGROUND_PAGES, num_background_pages));
472 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16(
473 IDS_UPDATE_NOW, product_name));
474 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16(
475 IDS_VIEW_INCOMPATIBILITIES));
476
477 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
478 SetIcon(GetIndexOfCommandId(IDC_UPGRADE_DIALOG),
479 *rb.GetBitmapNamed(IDR_UPDATE_MENU));
480 #if defined(OS_WIN)
481 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES),
482 *rb.GetBitmapNamed(IDR_CONFLICT_MENU));
483 #endif
484
485 // Add an icon to the View Background Pages item if there are unacknowledged
486 // pages.
487 if (BackgroundPageTracker::GetSingleton()->
488 GetUnacknowledgedBackgroundPageCount() > 0) {
489 SetIcon(GetIndexOfCommandId(IDC_VIEW_BACKGROUND_PAGES),
490 GetBackgroundPageIcon());
491 }
492
493 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE);
494 if (browser_defaults::kShowExitMenuItem) {
495 AddSeparator();
496 #if defined(OS_CHROMEOS)
497 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
498 AddItemWithStringId(IDC_EXIT, IDS_EXIT_GUEST_MODE);
499 } else {
500 AddItemWithStringId(IDC_EXIT, IDS_SIGN_OUT);
501 }
502 #else
503 AddItemWithStringId(IDC_EXIT, IDS_EXIT);
504 #endif
505 }
506 }
507
508 void WrenchMenuModel::CreateCutCopyPaste() {
509 // WARNING: views/wrench_menu assumes these items are added in this order. If
510 // you change the order you'll need to update wrench_menu as well.
511 AddItemWithStringId(IDC_CUT, IDS_CUT);
512 AddItemWithStringId(IDC_COPY, IDS_COPY);
513 AddItemWithStringId(IDC_PASTE, IDS_PASTE);
514 }
515
516 void WrenchMenuModel::CreateZoomFullscreen() {
517 // WARNING: views/wrench_menu assumes these items are added in this order. If
518 // you change the order you'll need to update wrench_menu as well.
519 AddItemWithStringId(IDC_ZOOM_MINUS, IDS_ZOOM_MINUS);
520 AddItemWithStringId(IDC_ZOOM_PLUS, IDS_ZOOM_PLUS);
521 AddItemWithStringId(IDC_FULLSCREEN, IDS_FULLSCREEN);
522 }
523
524 void WrenchMenuModel::UpdateZoomControls() {
525 bool enable_increment = false;
526 bool enable_decrement = false;
527 int zoom_percent = 100;
528 if (browser_->GetSelectedTabContents()) {
529 zoom_percent = browser_->GetSelectedTabContents()->GetZoomPercent(
530 &enable_increment, &enable_decrement);
531 }
532 zoom_label_ = l10n_util::GetStringFUTF16(
533 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
534 }
535
536 string16 WrenchMenuModel::GetSyncMenuLabel() const {
537 return sync_ui_util::GetSyncMenuLabel(
538 browser_->profile()->GetOriginalProfile()->GetProfileSyncService());
539 }
OLDNEW
« no previous file with comments | « chrome/browser/wrench_menu_model.h ('k') | chrome/browser/wrench_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698