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

Side by Side Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/uninstall_view.cc ('k') | views/controls/label.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/views/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_menu.h"
6 6
7 #include <algorithm>
7 #include <cmath> 8 #include <cmath>
9 #include <set>
8 10
9 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" 18 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
17 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 increment_button_(NULL), 391 increment_button_(NULL),
390 zoom_label_(NULL), 392 zoom_label_(NULL),
391 decrement_button_(NULL), 393 decrement_button_(NULL),
392 fullscreen_button_(NULL), 394 fullscreen_button_(NULL),
393 zoom_label_width_(0) { 395 zoom_label_width_(0) {
394 decrement_button_ = CreateButtonWithAccName( 396 decrement_button_ = CreateButtonWithAccName(
395 IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index, 397 IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index,
396 NULL, IDS_ACCNAME_ZOOM_MINUS2); 398 NULL, IDS_ACCNAME_ZOOM_MINUS2);
397 399
398 zoom_label_ = new Label( 400 zoom_label_ = new Label(
399 UTF16ToWide(l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100))); 401 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100));
400 zoom_label_->SetColor(MenuConfig::instance().text_color); 402 zoom_label_->SetColor(MenuConfig::instance().text_color);
401 zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT); 403 zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT);
402 MenuButtonBackground* center_bg = 404 MenuButtonBackground* center_bg =
403 new MenuButtonBackground(MenuButtonBackground::CENTER_BUTTON); 405 new MenuButtonBackground(MenuButtonBackground::CENTER_BUTTON);
404 zoom_label_->set_background(center_bg); 406 zoom_label_->set_background(center_bg);
405 zoom_label_->set_border(new MenuButtonBorder()); 407 zoom_label_->set_border(new MenuButtonBorder());
406 zoom_label_->SetFont(MenuConfig::instance().font); 408 zoom_label_->SetFont(MenuConfig::instance().font);
407 AddChildView(zoom_label_); 409 AddChildView(zoom_label_);
408 zoom_label_width_ = MaxWidthForZoomLabel(); 410 zoom_label_width_ = MaxWidthForZoomLabel();
409 411
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 private: 497 private:
496 void UpdateZoomControls() { 498 void UpdateZoomControls() {
497 bool enable_increment = false; 499 bool enable_increment = false;
498 bool enable_decrement = false; 500 bool enable_decrement = false;
499 TabContents* selected_tab = menu_->browser_->GetSelectedTabContents(); 501 TabContents* selected_tab = menu_->browser_->GetSelectedTabContents();
500 int zoom = 100; 502 int zoom = 100;
501 if (selected_tab) 503 if (selected_tab)
502 zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement); 504 zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement);
503 increment_button_->SetEnabled(enable_increment); 505 increment_button_->SetEnabled(enable_increment);
504 decrement_button_->SetEnabled(enable_decrement); 506 decrement_button_->SetEnabled(enable_decrement);
505 zoom_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16Int( 507 zoom_label_->SetText(
506 IDS_ZOOM_PERCENT, 508 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, zoom));
507 zoom)));
508 509
509 zoom_label_width_ = MaxWidthForZoomLabel(); 510 zoom_label_width_ = MaxWidthForZoomLabel();
510 } 511 }
511 512
512 // Calculates the max width the zoom string can be. 513 // Calculates the max width the zoom string can be.
513 int MaxWidthForZoomLabel() { 514 int MaxWidthForZoomLabel() {
514 gfx::Font font = zoom_label_->font(); 515 gfx::Font font = zoom_label_->font();
515 gfx::Insets insets; 516 gfx::Insets insets;
516 if (zoom_label_->border()) 517 if (zoom_label_->border())
517 zoom_label_->border()->GetInsets(&insets); 518 zoom_label_->border()->GetInsets(&insets);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 browser_->window()->GetNativeHandle()); 861 browser_->window()->GetNativeHandle());
861 bookmark_menu_delegate_.reset( 862 bookmark_menu_delegate_.reset(
862 new BookmarkMenuDelegate(browser_->profile(), 863 new BookmarkMenuDelegate(browser_->profile(),
863 NULL, 864 NULL,
864 parent, 865 parent,
865 first_bookmark_command_id_)); 866 first_bookmark_command_id_));
866 bookmark_menu_delegate_->Init( 867 bookmark_menu_delegate_->Init(
867 this, bookmark_menu_, model->bookmark_bar_node(), 0, 868 this, bookmark_menu_, model->bookmark_bar_node(), 0,
868 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); 869 BookmarkMenuDelegate::SHOW_OTHER_FOLDER);
869 } 870 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/uninstall_view.cc ('k') | views/controls/label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698