OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // views::DialogDelegateView: | 146 // views::DialogDelegateView: |
147 virtual int GetDialogButtons() const OVERRIDE; | 147 virtual int GetDialogButtons() const OVERRIDE; |
148 virtual base::string16 GetDialogButtonLabel( | 148 virtual base::string16 GetDialogButtonLabel( |
149 ui::DialogButton button) const OVERRIDE; | 149 ui::DialogButton button) const OVERRIDE; |
150 virtual int GetDefaultDialogButton() const OVERRIDE; | 150 virtual int GetDefaultDialogButton() const OVERRIDE; |
151 virtual bool Cancel() OVERRIDE; | 151 virtual bool Cancel() OVERRIDE; |
152 virtual bool Accept() OVERRIDE; | 152 virtual bool Accept() OVERRIDE; |
153 virtual ui::ModalType GetModalType() const OVERRIDE; | 153 virtual ui::ModalType GetModalType() const OVERRIDE; |
154 virtual base::string16 GetWindowTitle() const OVERRIDE; | 154 virtual base::string16 GetWindowTitle() const OVERRIDE; |
155 virtual void Layout() OVERRIDE; | 155 virtual void Layout() OVERRIDE; |
156 virtual gfx::Size GetPreferredSize() OVERRIDE; | 156 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
157 virtual void ViewHierarchyChanged( | 157 virtual void ViewHierarchyChanged( |
158 const ViewHierarchyChangedDetails& details) OVERRIDE; | 158 const ViewHierarchyChangedDetails& details) OVERRIDE; |
159 | 159 |
160 // views::LinkListener: | 160 // views::LinkListener: |
161 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 161 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
162 | 162 |
163 // views::ButtonListener: | 163 // views::ButtonListener: |
164 virtual void ButtonPressed(views::Button* sender, | 164 virtual void ButtonPressed(views::Button* sender, |
165 const ui::Event& event) OVERRIDE; | 165 const ui::Event& event) OVERRIDE; |
166 | 166 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 private: | 337 private: |
338 // A view which displays all the details of an IssueAdviceInfoEntry. | 338 // A view which displays all the details of an IssueAdviceInfoEntry. |
339 class DetailsView : public views::View { | 339 class DetailsView : public views::View { |
340 public: | 340 public: |
341 explicit DetailsView(int horizontal_space, bool parent_bulleted, | 341 explicit DetailsView(int horizontal_space, bool parent_bulleted, |
342 bool lighter_color); | 342 bool lighter_color); |
343 virtual ~DetailsView() {} | 343 virtual ~DetailsView() {} |
344 | 344 |
345 // views::View: | 345 // views::View: |
346 virtual gfx::Size GetPreferredSize() OVERRIDE; | 346 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
347 | 347 |
348 void AddDetail(const base::string16& detail); | 348 void AddDetail(const base::string16& detail); |
349 | 349 |
350 // Animates this to be a height proportional to |state|. | 350 // Animates this to be a height proportional to |state|. |
351 void AnimateToState(double state); | 351 void AnimateToState(double state); |
352 | 352 |
353 private: | 353 private: |
354 views::GridLayout* layout_; | 354 views::GridLayout* layout_; |
355 double state_; | 355 double state_; |
356 | 356 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1078 } |
1079 } | 1079 } |
1080 // Disable accept button if there are unchecked boxes and | 1080 // Disable accept button if there are unchecked boxes and |
1081 // the experiment is on. | 1081 // the experiment is on. |
1082 if (prompt_.experiment()->show_checkboxes()) | 1082 if (prompt_.experiment()->show_checkboxes()) |
1083 GetDialogClientView()->ok_button()->SetEnabled(unchecked_boxes_ == 0); | 1083 GetDialogClientView()->ok_button()->SetEnabled(unchecked_boxes_ == 0); |
1084 | 1084 |
1085 DialogDelegateView::Layout(); | 1085 DialogDelegateView::Layout(); |
1086 } | 1086 } |
1087 | 1087 |
1088 gfx::Size ExtensionInstallDialogView::GetPreferredSize() { | 1088 gfx::Size ExtensionInstallDialogView::GetPreferredSize() const { |
1089 return dialog_size_; | 1089 return dialog_size_; |
1090 } | 1090 } |
1091 | 1091 |
1092 void ExtensionInstallDialogView::ButtonPressed(views::Button* sender, | 1092 void ExtensionInstallDialogView::ButtonPressed(views::Button* sender, |
1093 const ui::Event& event) { | 1093 const ui::Event& event) { |
1094 if (std::string(views::Checkbox::kViewClassName) == sender->GetClassName()) { | 1094 if (std::string(views::Checkbox::kViewClassName) == sender->GetClassName()) { |
1095 views::Checkbox* checkbox = static_cast<views::Checkbox*>(sender); | 1095 views::Checkbox* checkbox = static_cast<views::Checkbox*>(sender); |
1096 if (checkbox->checked()) | 1096 if (checkbox->checked()) |
1097 --unchecked_boxes_; | 1097 --unchecked_boxes_; |
1098 else | 1098 else |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 new views::Label(PrepareForDisplay(detail, false)); | 1165 new views::Label(PrepareForDisplay(detail, false)); |
1166 detail_label->SetMultiLine(true); | 1166 detail_label->SetMultiLine(true); |
1167 detail_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1167 detail_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1168 if (lighter_color_) { | 1168 if (lighter_color_) { |
1169 detail_label->SetEnabledColor(kLighterLabelColor); | 1169 detail_label->SetEnabledColor(kLighterLabelColor); |
1170 detail_label->SetAutoColorReadabilityEnabled(false); | 1170 detail_label->SetAutoColorReadabilityEnabled(false); |
1171 } | 1171 } |
1172 layout_->AddView(detail_label); | 1172 layout_->AddView(detail_label); |
1173 } | 1173 } |
1174 | 1174 |
1175 gfx::Size ExpandableContainerView::DetailsView::GetPreferredSize() { | 1175 gfx::Size ExpandableContainerView::DetailsView::GetPreferredSize() const { |
1176 gfx::Size size = views::View::GetPreferredSize(); | 1176 gfx::Size size = views::View::GetPreferredSize(); |
1177 return gfx::Size(size.width(), size.height() * state_); | 1177 return gfx::Size(size.width(), size.height() * state_); |
1178 } | 1178 } |
1179 | 1179 |
1180 void ExpandableContainerView::DetailsView::AnimateToState(double state) { | 1180 void ExpandableContainerView::DetailsView::AnimateToState(double state) { |
1181 state_ = state; | 1181 state_ = state; |
1182 PreferredSizeChanged(); | 1182 PreferredSizeChanged(); |
1183 SchedulePaint(); | 1183 SchedulePaint(); |
1184 } | 1184 } |
1185 | 1185 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 if (slide_animation_.IsShowing()) | 1338 if (slide_animation_.IsShowing()) |
1339 slide_animation_.Hide(); | 1339 slide_animation_.Hide(); |
1340 else | 1340 else |
1341 slide_animation_.Show(); | 1341 slide_animation_.Show(); |
1342 } | 1342 } |
1343 | 1343 |
1344 void ExpandableContainerView::ExpandWithoutAnimation() { | 1344 void ExpandableContainerView::ExpandWithoutAnimation() { |
1345 expanded_ = true; | 1345 expanded_ = true; |
1346 details_view_->AnimateToState(1.0); | 1346 details_view_->AnimateToState(1.0); |
1347 } | 1347 } |
OLD | NEW |