| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 type_params.push_back(initial_focus ? 1 : 0); | 204 type_params.push_back(initial_focus ? 1 : 0); |
| 205 type_params.push_back(creator_xid); | 205 type_params.push_back(creator_xid); |
| 206 type_params.push_back(resize_type); | 206 type_params.push_back(resize_type); |
| 207 WmIpc::instance()->SetWindowType( | 207 WmIpc::instance()->SetWindowType( |
| 208 GTK_WIDGET(panel_), | 208 GTK_WIDGET(panel_), |
| 209 WM_IPC_WINDOW_CHROME_PANEL_CONTENT, | 209 WM_IPC_WINDOW_CHROME_PANEL_CONTENT, |
| 210 &type_params); | 210 &type_params); |
| 211 | 211 |
| 212 client_event_handler_id_ = g_signal_connect( | 212 client_event_handler_id_ = g_signal_connect( |
| 213 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); | 213 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); |
| 214 #endif // !USE_AURA | 214 #endif // !USE_AURA |
| 215 | 215 |
| 216 title_content_ = new TitleContentView(this); | 216 title_content_ = new TitleContentView(this); |
| 217 title_window_->SetContentsView(title_content_); | 217 title_window_->SetContentsView(title_content_); |
| 218 UpdateTitleBar(); | 218 UpdateTitleBar(); |
| 219 title_window_->Show(); | 219 title_window_->Show(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void PanelController::UpdateTitleBar() { | 222 void PanelController::UpdateTitleBar() { |
| 223 if (!delegate_ || !title_window_) | 223 if (!delegate_ || !title_window_) |
| 224 return; | 224 return; |
| 225 title_content_->title_label()->SetText( | 225 title_content_->title_label()->SetText(delegate_->GetPanelTitle()); |
| 226 UTF16ToWideHack(delegate_->GetPanelTitle())); | |
| 227 title_content_->title_icon()->SetImage(delegate_->GetPanelIcon()); | 226 title_content_->title_icon()->SetImage(delegate_->GetPanelIcon()); |
| 228 } | 227 } |
| 229 | 228 |
| 230 void PanelController::SetUrgent(bool urgent) { | 229 void PanelController::SetUrgent(bool urgent) { |
| 231 if (!urgent) | 230 if (!urgent) |
| 232 urgent_cleared_time_ = base::TimeTicks::Now(); | 231 urgent_cleared_time_ = base::TimeTicks::Now(); |
| 233 if (urgent == urgent_) | 232 if (urgent == urgent_) |
| 234 return; | 233 return; |
| 235 if (urgent && focused_) | 234 if (urgent && focused_) |
| 236 return; // Don't set urgency for focused panels. | 235 return; // Don't set urgency for focused panels. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 close_button_ = new views::ImageButton(this); | 432 close_button_ = new views::ImageButton(this); |
| 434 close_button_->SetImage(views::CustomButton::BS_NORMAL, close_button_n); | 433 close_button_->SetImage(views::CustomButton::BS_NORMAL, close_button_n); |
| 435 close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h); | 434 close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h); |
| 436 close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p); | 435 close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p); |
| 437 close_button_->SetBackground( | 436 close_button_->SetBackground( |
| 438 kTitleCloseButtonColor, close_button_n, close_button_m); | 437 kTitleCloseButtonColor, close_button_n, close_button_m); |
| 439 AddChildView(close_button_); | 438 AddChildView(close_button_); |
| 440 | 439 |
| 441 title_icon_ = new views::ImageView(); | 440 title_icon_ = new views::ImageView(); |
| 442 AddChildView(title_icon_); | 441 AddChildView(title_icon_); |
| 443 title_label_ = new views::Label(std::wstring()); | 442 title_label_ = new views::Label(string16()); |
| 444 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 443 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 445 AddChildView(title_label_); | 444 AddChildView(title_label_); |
| 446 | 445 |
| 447 set_background( | 446 set_background( |
| 448 views::Background::CreateBackgroundPainter( | 447 views::Background::CreateBackgroundPainter( |
| 449 true, new TitleBackgroundPainter(panel_controller))); | 448 true, new TitleBackgroundPainter(panel_controller))); |
| 450 OnFocusOut(); | 449 OnFocusOut(); |
| 451 } | 450 } |
| 452 | 451 |
| 453 void PanelController::TitleContentView::Layout() { | 452 void PanelController::TitleContentView::Layout() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 views::Button* sender, const views::Event& event) { | 511 views::Button* sender, const views::Event& event) { |
| 513 if (panel_controller_ && sender == close_button_) | 512 if (panel_controller_ && sender == close_button_) |
| 514 panel_controller_->OnCloseButtonPressed(); | 513 panel_controller_->OnCloseButtonPressed(); |
| 515 } | 514 } |
| 516 | 515 |
| 517 PanelController::TitleContentView::~TitleContentView() { | 516 PanelController::TitleContentView::~TitleContentView() { |
| 518 VLOG(1) << "panel: delete " << this; | 517 VLOG(1) << "panel: delete " << this; |
| 519 } | 518 } |
| 520 | 519 |
| 521 } // namespace chromeos | 520 } // namespace chromeos |
| OLD | NEW |