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

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

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