| 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 NOTIMPLEMENTED(); |
| 97 BrowserView::Deactivate(); | 97 BrowserView::Deactivate(); |
| 98 #endif | 98 #endif |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool PanelBrowserView::CanResize() const { | 101 bool PanelBrowserView::CanResize() const { |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool PanelBrowserView::CanMaximize() const { | 105 bool PanelBrowserView::CanMaximize() const { |
| 106 return false; | 106 return false; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 ui::WindowShowState* show_state) const { | 139 ui::WindowShowState* show_state) const { |
| 140 *bounds = bounds_; | 140 *bounds = bounds_; |
| 141 *show_state = ui::SHOW_STATE_NORMAL; | 141 *show_state = ui::SHOW_STATE_NORMAL; |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 void PanelBrowserView::OnWidgetActivationChanged(views::Widget* widget, | 145 void PanelBrowserView::OnWidgetActivationChanged(views::Widget* widget, |
| 146 bool active) { | 146 bool active) { |
| 147 ::BrowserView::OnWidgetActivationChanged(widget, active); | 147 ::BrowserView::OnWidgetActivationChanged(widget, active); |
| 148 | 148 |
| 149 #if defined(USE_AURA) | 149 #if defined(OS_WIN) && !defined(USE_AURA) |
| 150 // TODO(beng): | |
| 151 NOTIMPLEMENTED(); | |
| 152 bool focused = active; | |
| 153 #elif defined(OS_WIN) | |
| 154 // The panel window is in focus (actually accepting keystrokes) if it is | 150 // The panel window is in focus (actually accepting keystrokes) if it is |
| 155 // active and belongs to a foreground application. | 151 // active and belongs to a foreground application. |
| 156 bool focused = active && | 152 bool focused = active && |
| 157 GetFrameView()->GetWidget()->GetNativeView() == ::GetForegroundWindow(); | 153 GetFrameView()->GetWidget()->GetNativeView() == ::GetForegroundWindow(); |
| 158 #else | 154 #else |
| 159 // TODO(jianli): Investigate focus behavior for ChromeOS | 155 NOTIMPLEMENTED(); |
| 160 bool focused = active; | 156 bool focused = active; |
| 161 #endif | 157 #endif |
| 162 | 158 |
| 163 if (focused_ == focused) | 159 if (focused_ == focused) |
| 164 return; | 160 return; |
| 165 focused_ = focused; | 161 focused_ = focused; |
| 166 | 162 |
| 167 GetFrameView()->OnFocusChanged(focused); | 163 GetFrameView()->OnFocusChanged(focused); |
| 168 | 164 |
| 169 if (focused_) { | 165 if (focused_) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 panel_browser_view_->OnTitlebarMousePressed(point); | 500 panel_browser_view_->OnTitlebarMousePressed(point); |
| 505 } | 501 } |
| 506 | 502 |
| 507 void NativePanelTestingWin::ReleaseMouseButtonTitlebar() { | 503 void NativePanelTestingWin::ReleaseMouseButtonTitlebar() { |
| 508 panel_browser_view_->OnTitlebarMouseReleased(); | 504 panel_browser_view_->OnTitlebarMouseReleased(); |
| 509 } | 505 } |
| 510 | 506 |
| 511 void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) { | 507 void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) { |
| 512 // TODO(jianli): Need a comment here that explains why we use | 508 // TODO(jianli): Need a comment here that explains why we use |
| 513 // mouse_pressed_point_ and not current bounds as obtained by | 509 // mouse_pressed_point_ and not current bounds as obtained by |
| 514 // GetRestoredBounds(). | 510 // GetRestoredBounds(). http://crbug.com/102730 |
| 515 panel_browser_view_->OnTitlebarMouseDragged(gfx::Point( | 511 panel_browser_view_->OnTitlebarMouseDragged(gfx::Point( |
| 516 panel_browser_view_->mouse_pressed_point_.x() + delta_x, | 512 panel_browser_view_->mouse_pressed_point_.x() + delta_x, |
| 517 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); | 513 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); |
| 518 } | 514 } |
| 519 | 515 |
| 520 void NativePanelTestingWin::CancelDragTitlebar() { | 516 void NativePanelTestingWin::CancelDragTitlebar() { |
| 521 panel_browser_view_->OnTitlebarMouseCaptureLost(); | 517 panel_browser_view_->OnTitlebarMouseCaptureLost(); |
| 522 } | 518 } |
| 523 | 519 |
| 524 void NativePanelTestingWin::FinishDragTitlebar() { | 520 void NativePanelTestingWin::FinishDragTitlebar() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 546 } | 542 } |
| 547 | 543 |
| 548 bool NativePanelTestingWin::IsWindowSizeKnown() const { | 544 bool NativePanelTestingWin::IsWindowSizeKnown() const { |
| 549 return true; | 545 return true; |
| 550 } | 546 } |
| 551 | 547 |
| 552 bool NativePanelTestingWin::IsAnimatingBounds() const { | 548 bool NativePanelTestingWin::IsAnimatingBounds() const { |
| 553 return panel_browser_view_->bounds_animator_.get() && | 549 return panel_browser_view_->bounds_animator_.get() && |
| 554 panel_browser_view_->bounds_animator_->is_animating(); | 550 panel_browser_view_->bounds_animator_->is_animating(); |
| 555 } | 551 } |
| OLD | NEW |