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

Side by Side Diff: chrome/browser/chromeos/input_method/candidate_window.cc

Issue 8585022: clean up: Add DISALLOW_COPY_AND_ASSIGNs to candidate_window.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | 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/chromeos/input_method/candidate_window.h" 5 #include "chrome/browser/chromeos/input_method/candidate_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const int kMinPreeditAreaWidth = 134; 73 const int kMinPreeditAreaWidth = 134;
74 74
75 // The milliseconds of the delay to show the infolist window. 75 // The milliseconds of the delay to show the infolist window.
76 const int kInfolistShowDelayMilliSeconds = 500; 76 const int kInfolistShowDelayMilliSeconds = 500;
77 // The milliseconds of the delay to hide the infolist window. 77 // The milliseconds of the delay to hide the infolist window.
78 const int kInfolistHideDelayMilliSeconds = 500; 78 const int kInfolistHideDelayMilliSeconds = 500;
79 79
80 // VerticalCandidateLabel is used for rendering candidate text in 80 // VerticalCandidateLabel is used for rendering candidate text in
81 // the vertical candidate window. 81 // the vertical candidate window.
82 class VerticalCandidateLabel : public views::Label { 82 class VerticalCandidateLabel : public views::Label {
83 public:
84 VerticalCandidateLabel() {}
85
86 private:
83 virtual ~VerticalCandidateLabel() {} 87 virtual ~VerticalCandidateLabel() {}
84 88
85 // Returns the preferred size, but guarantees that the width has at 89 // Returns the preferred size, but guarantees that the width has at
86 // least kMinCandidateLabelWidth pixels. 90 // least kMinCandidateLabelWidth pixels.
87 virtual gfx::Size GetPreferredSize() { 91 virtual gfx::Size GetPreferredSize() {
88 gfx::Size size = Label::GetPreferredSize(); 92 gfx::Size size = Label::GetPreferredSize();
89 // Hack. +2 is needed to prevent labels from getting elided like 93 // Hack. +2 is needed to prevent labels from getting elided like
90 // "abc..." in some cases. TODO(satorux): Figure out why it's 94 // "abc..." in some cases. TODO(satorux): Figure out why it's
91 // necessary. 95 // necessary.
92 size.set_width(size.width() + 2); 96 size.set_width(size.width() + 2);
93 if (size.width() < kMinCandidateLabelWidth) { 97 if (size.width() < kMinCandidateLabelWidth) {
94 size.set_width(kMinCandidateLabelWidth); 98 size.set_width(kMinCandidateLabelWidth);
95 } 99 }
96 if (size.width() > kMaxCandidateLabelWidth) { 100 if (size.width() > kMaxCandidateLabelWidth) {
97 size.set_width(kMaxCandidateLabelWidth); 101 size.set_width(kMaxCandidateLabelWidth);
98 } 102 }
99 return size; 103 return size;
100 } 104 }
105
106 DISALLOW_COPY_AND_ASSIGN(VerticalCandidateLabel);
101 }; 107 };
102 108
103 // Wraps the given view with some padding, and returns it. 109 // Wraps the given view with some padding, and returns it.
104 views::View* WrapWithPadding(views::View* view, const gfx::Insets& insets) { 110 views::View* WrapWithPadding(views::View* view, const gfx::Insets& insets) {
105 views::View* wrapper = new views::View; 111 views::View* wrapper = new views::View;
106 // Use GridLayout to give some insets inside. 112 // Use GridLayout to give some insets inside.
107 views::GridLayout* layout = new views::GridLayout(wrapper); 113 views::GridLayout* layout = new views::GridLayout(wrapper);
108 wrapper->SetLayoutManager(layout); // |wrapper| owns |layout|. 114 wrapper->SetLayoutManager(layout); // |wrapper| owns |layout|.
109 layout->SetInsets(insets); 115 layout->SetInsets(insets);
110 116
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 370 }
365 371
366 // Returns the content. 372 // Returns the content.
367 views::View* contents() { 373 views::View* contents() {
368 return contents_.get(); 374 return contents_.get();
369 } 375 }
370 376
371 private: 377 private:
372 scoped_ptr<views::View> contents_; 378 scoped_ptr<views::View> contents_;
373 scoped_ptr<views::View> place_holder_; 379 scoped_ptr<views::View> place_holder_;
380
381 DISALLOW_COPY_AND_ASSIGN(HidableArea);
374 }; 382 };
375 383
376 // InformationTextArea is a HidableArea having a single Label in it. 384 // InformationTextArea is a HidableArea having a single Label in it.
377 class InformationTextArea : public HidableArea { 385 class InformationTextArea : public HidableArea {
378 public: 386 public:
379 // Specify the alignment and initialize the control. 387 // Specify the alignment and initialize the control.
380 InformationTextArea(views::Label::Alignment align, int minWidth) 388 InformationTextArea(views::Label::Alignment align, int minWidth)
381 : minWidth_(minWidth) { 389 : minWidth_(minWidth) {
382 label_ = new views::Label; 390 label_ = new views::Label;
383 label_->SetHorizontalAlignment(align); 391 label_->SetHorizontalAlignment(align);
(...skipping 22 matching lines...) Expand all
406 size.set_width(size.width() + 2); 414 size.set_width(size.width() + 2);
407 if (size.width() < minWidth_) { 415 if (size.width() < minWidth_) {
408 size.set_width(minWidth_); 416 size.set_width(minWidth_);
409 } 417 }
410 return size; 418 return size;
411 } 419 }
412 420
413 private: 421 private:
414 views::Label* label_; 422 views::Label* label_;
415 int minWidth_; 423 int minWidth_;
424
425 DISALLOW_COPY_AND_ASSIGN(InformationTextArea);
416 }; 426 };
417 427
418 // CandidateRow renderes a row of a candidate. 428 // CandidateRow renderes a row of a candidate.
419 class CandidateView : public views::View { 429 class CandidateView : public views::View {
420 public: 430 public:
421 CandidateView(CandidateWindowView* parent_candidate_window, 431 CandidateView(CandidateWindowView* parent_candidate_window,
422 int index_in_page, 432 int index_in_page,
423 InputMethodLookupTable::Orientation orientation); 433 InputMethodLookupTable::Orientation orientation);
424 virtual ~CandidateView() {} 434 virtual ~CandidateView() {}
425 // Initializes the candidate view with the given column widths. 435 // Initializes the candidate view with the given column widths.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // The shortcut label renders shortcut numbers like 1, 2, and 3. 488 // The shortcut label renders shortcut numbers like 1, 2, and 3.
479 views::Label* shortcut_label_; 489 views::Label* shortcut_label_;
480 // The candidate label renders candidates. 490 // The candidate label renders candidates.
481 views::Label* candidate_label_; 491 views::Label* candidate_label_;
482 // The annotation label renders annotations. 492 // The annotation label renders annotations.
483 views::Label* annotation_label_; 493 views::Label* annotation_label_;
484 494
485 // The infolist icon. 495 // The infolist icon.
486 views::Label* infolist_label_; 496 views::Label* infolist_label_;
487 bool infolist_icon_enabled_; 497 bool infolist_icon_enabled_;
498
499 DISALLOW_COPY_AND_ASSIGN(CandidateView);
488 }; 500 };
489 501
490 class InfolistView; 502 class InfolistView;
491 503
492 // InfolistWindowView is the main container of the infolist window UI. 504 // InfolistWindowView is the main container of the infolist window UI.
493 class InfolistWindowView : public views::View { 505 class InfolistWindowView : public views::View {
494 public: 506 public:
495 InfolistWindowView(views::Widget* parent_frame, 507 InfolistWindowView(views::Widget* parent_frame,
496 views::Widget* candidate_window_frame); 508 views::Widget* candidate_window_frame);
497 virtual ~InfolistWindowView(); 509 virtual ~InfolistWindowView();
(...skipping 29 matching lines...) Expand all
527 // The infolist area is where the meanings and the usages of the words are 539 // The infolist area is where the meanings and the usages of the words are
528 // rendered. 540 // rendered.
529 views::View* infolist_area_; 541 views::View* infolist_area_;
530 // The infolist views are used for rendering the meanings and the usages of 542 // The infolist views are used for rendering the meanings and the usages of
531 // the words. 543 // the words.
532 std::vector<InfolistView*> infolist_views_; 544 std::vector<InfolistView*> infolist_views_;
533 545
534 bool visible_; 546 bool visible_;
535 547
536 base::OneShotTimer<InfolistWindowView> show_hide_timer_; 548 base::OneShotTimer<InfolistWindowView> show_hide_timer_;
549
550 DISALLOW_COPY_AND_ASSIGN(InfolistWindowView);
537 }; 551 };
538 552
539 // InfolistRow renderes a row of a infolist. 553 // InfolistRow renderes a row of a infolist.
540 class InfolistView : public views::View { 554 class InfolistView : public views::View {
541 public: 555 public:
542 explicit InfolistView(InfolistWindowView* parent_infolist_window); 556 explicit InfolistView(InfolistWindowView* parent_infolist_window);
543 virtual ~InfolistView() {} 557 virtual ~InfolistView() {}
544 558
545 void Init(); 559 void Init();
546 560
(...skipping 19 matching lines...) Expand all
566 // The parent candidate window that contains this view. 580 // The parent candidate window that contains this view.
567 InfolistWindowView* parent_infolist_window_; 581 InfolistWindowView* parent_infolist_window_;
568 582
569 // Views created in the class will be part of tree of |this|, so these 583 // Views created in the class will be part of tree of |this|, so these
570 // child views will be deleted when |this| is deleted. 584 // child views will be deleted when |this| is deleted.
571 585
572 // The title label. 586 // The title label.
573 views::Label* title_label_; 587 views::Label* title_label_;
574 // The description label. 588 // The description label.
575 views::Label* description_label_; 589 views::Label* description_label_;
590
591 DISALLOW_COPY_AND_ASSIGN(InfolistView);
576 }; 592 };
577 593
578
579 // The implementation of CandidateWindowController. 594 // The implementation of CandidateWindowController.
580 // CandidateWindowController controls the CandidateWindow. 595 // CandidateWindowController controls the CandidateWindow.
581 class CandidateWindowController::Impl : public CandidateWindowView::Observer, 596 class CandidateWindowController::Impl : public CandidateWindowView::Observer,
582 public IBusUiController::Observer { 597 public IBusUiController::Observer {
583 public: 598 public:
584 Impl(); 599 Impl();
585 virtual ~Impl(); 600 virtual ~Impl();
586 601
587 // Initializes the candidate window. Returns true on success. 602 // Initializes the candidate window. Returns true on success.
588 bool Init(); 603 bool Init();
(...skipping 28 matching lines...) Expand all
617 // This is the outer frame of the candidate window view. The frame will 632 // This is the outer frame of the candidate window view. The frame will
618 // own |candidate_window_|. 633 // own |candidate_window_|.
619 scoped_ptr<views::Widget> frame_; 634 scoped_ptr<views::Widget> frame_;
620 635
621 // The infolist window view. 636 // The infolist window view.
622 InfolistWindowView* infolist_window_; 637 InfolistWindowView* infolist_window_;
623 638
624 // This is the outer frame of the infolist window view. The frame will 639 // This is the outer frame of the infolist window view. The frame will
625 // own |infolist_window_|. 640 // own |infolist_window_|.
626 scoped_ptr<views::Widget> infolist_frame_; 641 scoped_ptr<views::Widget> infolist_frame_;
642
643 DISALLOW_COPY_AND_ASSIGN(Impl);
627 }; 644 };
628 645
629 CandidateView::CandidateView( 646 CandidateView::CandidateView(
630 CandidateWindowView* parent_candidate_window, 647 CandidateWindowView* parent_candidate_window,
631 int index_in_page, 648 int index_in_page,
632 InputMethodLookupTable::Orientation orientation) 649 InputMethodLookupTable::Orientation orientation)
633 : index_in_page_(index_in_page), 650 : index_in_page_(index_in_page),
634 orientation_(orientation), 651 orientation_(orientation),
635 parent_candidate_window_(parent_candidate_window), 652 parent_candidate_window_(parent_candidate_window),
636 shortcut_label_(NULL), 653 shortcut_label_(NULL),
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 CandidateWindowController::~CandidateWindowController() { 1675 CandidateWindowController::~CandidateWindowController() {
1659 delete impl_; 1676 delete impl_;
1660 } 1677 }
1661 1678
1662 bool CandidateWindowController::Init() { 1679 bool CandidateWindowController::Init() {
1663 return impl_->Init(); 1680 return impl_->Init();
1664 } 1681 }
1665 1682
1666 } // namespace input_method 1683 } // namespace input_method
1667 } // namespace chromeos 1684 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698