Chromium Code Reviews| 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/ui/panels/panel_browser_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" | 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 panel_->manager()->GetNextBrowserWindowToActivate(panel_.get()); | 86 panel_->manager()->GetNextBrowserWindowToActivate(panel_.get()); |
| 87 if (browser_window) | 87 if (browser_window) |
| 88 native_window = browser_window->GetNativeHandle(); | 88 native_window = browser_window->GetNativeHandle(); |
| 89 else | 89 else |
| 90 native_window = ::GetDesktopWindow(); | 90 native_window = ::GetDesktopWindow(); |
| 91 if (native_window) | 91 if (native_window) |
| 92 ::SetForegroundWindow(native_window); | 92 ::SetForegroundWindow(native_window); |
| 93 else | 93 else |
| 94 ::SetFocus(NULL); | 94 ::SetFocus(NULL); |
| 95 #else | 95 #else |
| 96 // TODO(jianli): to be implemented for other platform. | 96 // TODO(jianli): Implement for USE_AURA. |
|
Dmitry Titov
2011/11/02 22:15:01
Didn't want a bug for this, maybe we shoudl just r
jennb
2011/11/02 22:25:31
Agree w/ removing TODO.
Dmitry Titov
2011/11/02 23:32:19
Done.
| |
| 97 NOTIMPLEMENTED(); | |
| 97 BrowserView::Deactivate(); | 98 BrowserView::Deactivate(); |
| 98 #endif | 99 #endif |
| 99 } | 100 } |
| 100 | 101 |
| 101 bool PanelBrowserView::CanResize() const { | 102 bool PanelBrowserView::CanResize() const { |
| 102 return false; | 103 return false; |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool PanelBrowserView::CanMaximize() const { | 106 bool PanelBrowserView::CanMaximize() const { |
| 106 return false; | 107 return false; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 *bounds = bounds_; | 141 *bounds = bounds_; |
| 141 *show_state = ui::SHOW_STATE_NORMAL; | 142 *show_state = ui::SHOW_STATE_NORMAL; |
| 142 return true; | 143 return true; |
| 143 } | 144 } |
| 144 | 145 |
| 145 void PanelBrowserView::OnWidgetActivationChanged(views::Widget* widget, | 146 void PanelBrowserView::OnWidgetActivationChanged(views::Widget* widget, |
| 146 bool active) { | 147 bool active) { |
| 147 ::BrowserView::OnWidgetActivationChanged(widget, active); | 148 ::BrowserView::OnWidgetActivationChanged(widget, active); |
| 148 | 149 |
| 149 #if defined(USE_AURA) | 150 #if defined(USE_AURA) |
| 150 // TODO(beng): | 151 // TODO(beng): Implement for USE_AURA. |
| 151 NOTIMPLEMENTED(); | 152 NOTIMPLEMENTED(); |
| 152 bool focused = active; | 153 bool focused = active; |
| 153 #elif defined(OS_WIN) | 154 #elif defined(OS_WIN) |
| 154 // The panel window is in focus (actually accepting keystrokes) if it is | 155 // The panel window is in focus (actually accepting keystrokes) if it is |
| 155 // active and belongs to a foreground application. | 156 // active and belongs to a foreground application. |
| 156 bool focused = active && | 157 bool focused = active && |
| 157 GetFrameView()->GetWidget()->GetNativeView() == ::GetForegroundWindow(); | 158 GetFrameView()->GetWidget()->GetNativeView() == ::GetForegroundWindow(); |
| 158 #else | 159 #else |
| 159 // TODO(jianli): Investigate focus behavior for ChromeOS | 160 NOTREACHED(); // View-based Panels are not enabled anywhere else. |
|
jennb
2011/11/02 22:25:31
Can we delete the #else clause completely and conv
Dmitry Titov
2011/11/02 23:32:19
Done.
Made it consistent with the case in Deactiva
| |
| 160 bool focused = active; | 161 bool focused = active; |
| 161 #endif | 162 #endif |
| 162 | 163 |
| 163 if (focused_ == focused) | 164 if (focused_ == focused) |
| 164 return; | 165 return; |
| 165 focused_ = focused; | 166 focused_ = focused; |
| 166 | 167 |
| 167 GetFrameView()->OnFocusChanged(focused); | 168 GetFrameView()->OnFocusChanged(focused); |
| 168 | 169 |
| 169 if (focused_) { | 170 if (focused_) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 panel_browser_view_->OnTitlebarMousePressed(point); | 505 panel_browser_view_->OnTitlebarMousePressed(point); |
| 505 } | 506 } |
| 506 | 507 |
| 507 void NativePanelTestingWin::ReleaseMouseButtonTitlebar() { | 508 void NativePanelTestingWin::ReleaseMouseButtonTitlebar() { |
| 508 panel_browser_view_->OnTitlebarMouseReleased(); | 509 panel_browser_view_->OnTitlebarMouseReleased(); |
| 509 } | 510 } |
| 510 | 511 |
| 511 void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) { | 512 void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) { |
| 512 // TODO(jianli): Need a comment here that explains why we use | 513 // TODO(jianli): Need a comment here that explains why we use |
| 513 // mouse_pressed_point_ and not current bounds as obtained by | 514 // mouse_pressed_point_ and not current bounds as obtained by |
| 514 // GetRestoredBounds(). | 515 // GetRestoredBounds(). http://crbug.com/102730 |
| 515 panel_browser_view_->OnTitlebarMouseDragged(gfx::Point( | 516 panel_browser_view_->OnTitlebarMouseDragged(gfx::Point( |
| 516 panel_browser_view_->mouse_pressed_point_.x() + delta_x, | 517 panel_browser_view_->mouse_pressed_point_.x() + delta_x, |
| 517 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); | 518 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); |
| 518 } | 519 } |
| 519 | 520 |
| 520 void NativePanelTestingWin::CancelDragTitlebar() { | 521 void NativePanelTestingWin::CancelDragTitlebar() { |
| 521 panel_browser_view_->OnTitlebarMouseCaptureLost(); | 522 panel_browser_view_->OnTitlebarMouseCaptureLost(); |
| 522 } | 523 } |
| 523 | 524 |
| 524 void NativePanelTestingWin::FinishDragTitlebar() { | 525 void NativePanelTestingWin::FinishDragTitlebar() { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 546 } | 547 } |
| 547 | 548 |
| 548 bool NativePanelTestingWin::IsWindowSizeKnown() const { | 549 bool NativePanelTestingWin::IsWindowSizeKnown() const { |
| 549 return true; | 550 return true; |
| 550 } | 551 } |
| 551 | 552 |
| 552 bool NativePanelTestingWin::IsAnimatingBounds() const { | 553 bool NativePanelTestingWin::IsAnimatingBounds() const { |
| 553 return panel_browser_view_->bounds_animator_.get() && | 554 return panel_browser_view_->bounds_animator_.get() && |
| 554 panel_browser_view_->bounds_animator_->is_animating(); | 555 panel_browser_view_->bounds_animator_->is_animating(); |
| 555 } | 556 } |
| OLD | NEW |