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

Side by Side Diff: ash/shelf/shelf_button.cc

Issue 614653002: ash::ShelfView: CHECK against potentially bad static_casts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « ash/shelf/shelf_button.h ('k') | ash/shelf/shelf_view.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/shelf/shelf_button.h" 5 #include "ash/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // handling. 197 // handling.
198 set_interactive(false); 198 set_interactive(false);
199 } 199 }
200 200
201 ShelfButton::IconView::~IconView() { 201 ShelfButton::IconView::~IconView() {
202 } 202 }
203 203
204 //////////////////////////////////////////////////////////////////////////////// 204 ////////////////////////////////////////////////////////////////////////////////
205 // ShelfButton 205 // ShelfButton
206 206
207 // static
208 const char ShelfButton::kViewClassName[] = "ash/ShelfButton";
209
207 ShelfButton* ShelfButton::Create(views::ButtonListener* listener, 210 ShelfButton* ShelfButton::Create(views::ButtonListener* listener,
208 ShelfButtonHost* host, 211 ShelfButtonHost* host,
209 ShelfLayoutManager* shelf_layout_manager) { 212 ShelfLayoutManager* shelf_layout_manager) {
210 ShelfButton* button = new ShelfButton(listener, host, shelf_layout_manager); 213 ShelfButton* button = new ShelfButton(listener, host, shelf_layout_manager);
211 button->Init(); 214 button->Init();
212 return button; 215 return button;
213 } 216 }
214 217
215 ShelfButton::ShelfButton(views::ButtonListener* listener, 218 ShelfButton::ShelfButton(views::ButtonListener* listener,
216 ShelfButtonHost* host, 219 ShelfButtonHost* host,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 317
315 if (!destroyed) { 318 if (!destroyed) {
316 destroyed_flag_ = NULL; 319 destroyed_flag_ = NULL;
317 // The menu will not propagate mouse events while its shown. To address, 320 // The menu will not propagate mouse events while its shown. To address,
318 // the hover state gets cleared once the menu was shown (and this was not 321 // the hover state gets cleared once the menu was shown (and this was not
319 // destroyed). 322 // destroyed).
320 ClearState(STATE_HOVERED); 323 ClearState(STATE_HOVERED);
321 } 324 }
322 } 325 }
323 326
327 const char* ShelfButton::GetClassName() const {
328 return kViewClassName;
329 }
330
324 bool ShelfButton::OnMousePressed(const ui::MouseEvent& event) { 331 bool ShelfButton::OnMousePressed(const ui::MouseEvent& event) {
325 CustomButton::OnMousePressed(event); 332 CustomButton::OnMousePressed(event);
326 host_->PointerPressedOnButton(this, ShelfButtonHost::MOUSE, event); 333 host_->PointerPressedOnButton(this, ShelfButtonHost::MOUSE, event);
327 return true; 334 return true;
328 } 335 }
329 336
330 void ShelfButton::OnMouseReleased(const ui::MouseEvent& event) { 337 void ShelfButton::OnMouseReleased(const ui::MouseEvent& event) {
331 CustomButton::OnMouseReleased(event); 338 CustomButton::OnMouseReleased(event);
332 host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, false); 339 host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, false);
333 } 340 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 views::ImageView::CENTER, 541 views::ImageView::CENTER,
535 views::ImageView::CENTER, 542 views::ImageView::CENTER,
536 views::ImageView::LEADING)); 543 views::ImageView::LEADING));
537 bar_->SchedulePaint(); 544 bar_->SchedulePaint();
538 } 545 }
539 546
540 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 547 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
541 } 548 }
542 549
543 } // namespace ash 550 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_button.h ('k') | ash/shelf/shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698