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

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 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 | « ui/views/controls/button/text_button.cc ('k') | ui/views/controls/label_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/combobox/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 base::i18n::AdjustStringForLocaleDirection(&text); 586 base::i18n::AdjustStringForLocaleDirection(&text);
587 587
588 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL); 588 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL);
589 max_width = std::max(max_width, gfx::GetStringWidth(text, font_list)); 589 max_width = std::max(max_width, gfx::GetStringWidth(text, font_list));
590 } 590 }
591 591
592 content_size_.SetSize(max_width, font_list.GetHeight()); 592 content_size_.SetSize(max_width, font_list.GetHeight());
593 } 593 }
594 594
595 void Combobox::UpdateBorder() { 595 void Combobox::UpdateBorder() {
596 FocusableBorder* border = new FocusableBorder(); 596 scoped_ptr<FocusableBorder> border(new FocusableBorder());
597 if (style_ == STYLE_NOTIFY_ON_CLICK) 597 if (style_ == STYLE_NOTIFY_ON_CLICK)
598 border->SetInsets(8, 13, 8, 13); 598 border->SetInsets(8, 13, 8, 13);
599 if (invalid_) 599 if (invalid_)
600 border->SetColor(kWarningColor); 600 border->SetColor(kWarningColor);
601 set_border(border); 601 SetBorder(border.PassAs<Border>());
602 } 602 }
603 603
604 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const { 604 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const {
605 rect->set_x(GetMirroredXForRect(*rect)); 605 rect->set_x(GetMirroredXForRect(*rect));
606 } 606 }
607 607
608 void Combobox::PaintText(gfx::Canvas* canvas) { 608 void Combobox::PaintText(gfx::Canvas* canvas) {
609 gfx::Insets insets = GetInsets(); 609 gfx::Insets insets = GetInsets();
610 610
611 gfx::ScopedCanvas scoped_canvas(canvas); 611 gfx::ScopedCanvas scoped_canvas(canvas);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 790
791 void Combobox::HandleClickEvent() { 791 void Combobox::HandleClickEvent() {
792 if (style_ != STYLE_NOTIFY_ON_CLICK) 792 if (style_ != STYLE_NOTIFY_ON_CLICK)
793 return; 793 return;
794 794
795 if (listener_) 795 if (listener_)
796 listener_->OnComboboxTextButtonClicked(this); 796 listener_->OnComboboxTextButtonClicked(this);
797 } 797 }
798 798
799 } // namespace views 799 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/text_button.cc ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698