| OLD | NEW |
| 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/frame/panel_controller.h" | 5 #include "chrome/browser/chromeos/frame/panel_controller.h" |
| 6 | 6 |
| 7 #if defined(TOUCH_UI) | 7 #if defined(TOUCH_UI) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #endif | 10 #endif |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 urgent_cleared_time_ = base::TimeTicks::Now(); | 231 urgent_cleared_time_ = base::TimeTicks::Now(); |
| 232 if (urgent == urgent_) | 232 if (urgent == urgent_) |
| 233 return; | 233 return; |
| 234 if (urgent && focused_) | 234 if (urgent && focused_) |
| 235 return; // Don't set urgency for focused panels. | 235 return; // Don't set urgency for focused panels. |
| 236 if (urgent && base::TimeTicks::Now() < urgent_cleared_time_ + kSetUrgentDelay) | 236 if (urgent && base::TimeTicks::Now() < urgent_cleared_time_ + kSetUrgentDelay) |
| 237 return; // Don't set urgency immediately after clearing it. | 237 return; // Don't set urgency immediately after clearing it. |
| 238 urgent_ = urgent; | 238 urgent_ = urgent; |
| 239 if (title_window_) { | 239 if (title_window_) { |
| 240 gtk_window_set_urgency_hint(panel_, urgent ? TRUE : FALSE); | 240 gtk_window_set_urgency_hint(panel_, urgent ? TRUE : FALSE); |
| 241 title_content_->title_label()->SetDisabledColor(urgent ? |
| 242 kTitleUrgentTextColor : kTitleInactiveTextColor); |
| 241 title_content_->SchedulePaint(); | 243 title_content_->SchedulePaint(); |
| 242 if (urgent) | |
| 243 title_content_->title_label()->SetColor(kTitleUrgentTextColor); | |
| 244 else | |
| 245 title_content_->title_label()->SetColor(kTitleInactiveTextColor); | |
| 246 } | 244 } |
| 247 } | 245 } |
| 248 | 246 |
| 249 bool PanelController::TitleMousePressed(const views::MouseEvent& event) { | 247 bool PanelController::TitleMousePressed(const views::MouseEvent& event) { |
| 250 if (!event.IsOnlyLeftMouseButton()) | 248 if (!event.IsOnlyLeftMouseButton()) |
| 251 return false; | 249 return false; |
| 252 if (event.type() != ui::ET_MOUSE_PRESSED) { | 250 if (event.type() != ui::ET_MOUSE_PRESSED) { |
| 253 NOTREACHED(); | 251 NOTREACHED(); |
| 254 return false; | 252 return false; |
| 255 } | 253 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h); | 432 close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h); |
| 435 close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p); | 433 close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p); |
| 436 close_button_->SetBackground( | 434 close_button_->SetBackground( |
| 437 kTitleCloseButtonColor, close_button_n, close_button_m); | 435 kTitleCloseButtonColor, close_button_n, close_button_m); |
| 438 AddChildView(close_button_); | 436 AddChildView(close_button_); |
| 439 | 437 |
| 440 title_icon_ = new views::ImageView(); | 438 title_icon_ = new views::ImageView(); |
| 441 AddChildView(title_icon_); | 439 AddChildView(title_icon_); |
| 442 title_label_ = new views::Label(string16()); | 440 title_label_ = new views::Label(string16()); |
| 443 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 441 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 442 title_label_->SetAutoColorReadabilityEnabled(false); |
| 443 title_label_->SetEnabledColor(kTitleActiveTextColor); |
| 444 title_label_->SetDisabledColor(kTitleInactiveTextColor); |
| 445 title_label_->SetEnabled(false); |
| 444 AddChildView(title_label_); | 446 AddChildView(title_label_); |
| 445 | 447 |
| 446 set_background( | 448 set_background( |
| 447 views::Background::CreateBackgroundPainter( | 449 views::Background::CreateBackgroundPainter( |
| 448 true, new TitleBackgroundPainter(panel_controller))); | 450 true, new TitleBackgroundPainter(panel_controller))); |
| 449 OnFocusOut(); | 451 OnFocusOut(); |
| 450 } | 452 } |
| 451 | 453 |
| 452 void PanelController::TitleContentView::Layout() { | 454 void PanelController::TitleContentView::Layout() { |
| 453 int close_button_x = bounds().width() - | 455 int close_button_x = bounds().width() - |
| (...skipping 29 matching lines...) Expand all Loading... |
| 483 void PanelController::TitleContentView::OnMouseCaptureLost() { | 485 void PanelController::TitleContentView::OnMouseCaptureLost() { |
| 484 panel_controller_->TitleMouseCaptureLost(); | 486 panel_controller_->TitleMouseCaptureLost(); |
| 485 } | 487 } |
| 486 | 488 |
| 487 bool PanelController::TitleContentView::OnMouseDragged( | 489 bool PanelController::TitleContentView::OnMouseDragged( |
| 488 const views::MouseEvent& event) { | 490 const views::MouseEvent& event) { |
| 489 return panel_controller_->TitleMouseDragged(event); | 491 return panel_controller_->TitleMouseDragged(event); |
| 490 } | 492 } |
| 491 | 493 |
| 492 void PanelController::TitleContentView::OnFocusIn() { | 494 void PanelController::TitleContentView::OnFocusIn() { |
| 493 title_label_->SetColor(kTitleActiveTextColor); | 495 title_label_->SetEnabled(true); |
| 494 title_label_->SetFont(*active_font); | 496 title_label_->SetFont(*active_font); |
| 495 Layout(); | 497 Layout(); |
| 496 SchedulePaint(); | 498 SchedulePaint(); |
| 497 } | 499 } |
| 498 | 500 |
| 499 void PanelController::TitleContentView::OnFocusOut() { | 501 void PanelController::TitleContentView::OnFocusOut() { |
| 500 title_label_->SetColor(kTitleInactiveTextColor); | 502 title_label_->SetEnabled(false); |
| 501 title_label_->SetFont(*inactive_font); | 503 title_label_->SetFont(*inactive_font); |
| 502 Layout(); | 504 Layout(); |
| 503 SchedulePaint(); | 505 SchedulePaint(); |
| 504 } | 506 } |
| 505 | 507 |
| 506 void PanelController::TitleContentView::OnClose() { | 508 void PanelController::TitleContentView::OnClose() { |
| 507 panel_controller_ = NULL; | 509 panel_controller_ = NULL; |
| 508 } | 510 } |
| 509 | 511 |
| 510 void PanelController::TitleContentView::ButtonPressed( | 512 void PanelController::TitleContentView::ButtonPressed( |
| 511 views::Button* sender, const views::Event& event) { | 513 views::Button* sender, const views::Event& event) { |
| 512 if (panel_controller_ && sender == close_button_) | 514 if (panel_controller_ && sender == close_button_) |
| 513 panel_controller_->OnCloseButtonPressed(); | 515 panel_controller_->OnCloseButtonPressed(); |
| 514 } | 516 } |
| 515 | 517 |
| 516 PanelController::TitleContentView::~TitleContentView() { | 518 PanelController::TitleContentView::~TitleContentView() { |
| 517 VLOG(1) << "panel: delete " << this; | 519 VLOG(1) << "panel: delete " << this; |
| 518 } | 520 } |
| 519 | 521 |
| 520 } // namespace chromeos | 522 } // namespace chromeos |
| OLD | NEW |