OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cocoa/panels/panel_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/panels/panel_cocoa.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
9 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" | 9 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" |
10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" | 10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 void PanelCocoa::DidCloseNativeWindow() { | 317 void PanelCocoa::DidCloseNativeWindow() { |
318 DCHECK(!IsClosed()); | 318 DCHECK(!IsClosed()); |
319 controller_ = NULL; | 319 controller_ = NULL; |
320 panel_->OnNativePanelClosed(); | 320 panel_->OnNativePanelClosed(); |
321 } | 321 } |
322 | 322 |
323 // NativePanelTesting implementation. | 323 // NativePanelTesting implementation. |
324 class CocoaNativePanelTesting : public NativePanelTesting { | 324 class CocoaNativePanelTesting : public NativePanelTesting { |
325 public: | 325 public: |
326 CocoaNativePanelTesting(NativePanel* native_panel); | 326 CocoaNativePanelTesting(NativePanel* native_panel); |
327 virtual ~CocoaNativePanelTesting() { } | 327 ~CocoaNativePanelTesting() override {} |
328 // Overridden from NativePanelTesting | 328 // Overridden from NativePanelTesting |
329 virtual void PressLeftMouseButtonTitlebar( | 329 void PressLeftMouseButtonTitlebar(const gfx::Point& mouse_location, |
330 const gfx::Point& mouse_location, panel::ClickModifier modifier) override; | 330 panel::ClickModifier modifier) override; |
331 virtual void ReleaseMouseButtonTitlebar( | 331 void ReleaseMouseButtonTitlebar(panel::ClickModifier modifier) override; |
332 panel::ClickModifier modifier) override; | 332 void DragTitlebar(const gfx::Point& mouse_location) override; |
333 virtual void DragTitlebar(const gfx::Point& mouse_location) override; | 333 void CancelDragTitlebar() override; |
334 virtual void CancelDragTitlebar() override; | 334 void FinishDragTitlebar() override; |
335 virtual void FinishDragTitlebar() override; | 335 bool VerifyDrawingAttention() const override; |
336 virtual bool VerifyDrawingAttention() const override; | 336 bool VerifyActiveState(bool is_active) override; |
337 virtual bool VerifyActiveState(bool is_active) override; | 337 bool VerifyAppIcon() const override; |
338 virtual bool VerifyAppIcon() const override; | 338 bool VerifySystemMinimizeState() const override; |
339 virtual bool VerifySystemMinimizeState() const override; | 339 bool IsWindowVisible() const override; |
340 virtual bool IsWindowVisible() const override; | 340 bool IsWindowSizeKnown() const override; |
341 virtual bool IsWindowSizeKnown() const override; | 341 bool IsAnimatingBounds() const override; |
342 virtual bool IsAnimatingBounds() const override; | 342 bool IsButtonVisible(panel::TitlebarButtonType button_type) const override; |
343 virtual bool IsButtonVisible( | 343 panel::CornerStyle GetWindowCornerStyle() const override; |
344 panel::TitlebarButtonType button_type) const override; | 344 bool EnsureApplicationRunOnForeground() override; |
345 virtual panel::CornerStyle GetWindowCornerStyle() const override; | |
346 virtual bool EnsureApplicationRunOnForeground() override; | |
347 | 345 |
348 private: | 346 private: |
349 PanelTitlebarViewCocoa* titlebar() const; | 347 PanelTitlebarViewCocoa* titlebar() const; |
350 // Weak, assumed always to outlive this test API object. | 348 // Weak, assumed always to outlive this test API object. |
351 PanelCocoa* native_panel_window_; | 349 PanelCocoa* native_panel_window_; |
352 }; | 350 }; |
353 | 351 |
354 NativePanelTesting* PanelCocoa::CreateNativePanelTesting() { | 352 NativePanelTesting* PanelCocoa::CreateNativePanelTesting() { |
355 return new CocoaNativePanelTesting(this); | 353 return new CocoaNativePanelTesting(this); |
356 } | 354 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 panel::CornerStyle CocoaNativePanelTesting::GetWindowCornerStyle() const { | 450 panel::CornerStyle CocoaNativePanelTesting::GetWindowCornerStyle() const { |
453 return native_panel_window_->corner_style_; | 451 return native_panel_window_->corner_style_; |
454 } | 452 } |
455 | 453 |
456 bool CocoaNativePanelTesting::EnsureApplicationRunOnForeground() { | 454 bool CocoaNativePanelTesting::EnsureApplicationRunOnForeground() { |
457 if ([NSApp isActive]) | 455 if ([NSApp isActive]) |
458 return true; | 456 return true; |
459 [NSApp activateIgnoringOtherApps:YES]; | 457 [NSApp activateIgnoringOtherApps:YES]; |
460 return [NSApp isActive]; | 458 return [NSApp isActive]; |
461 } | 459 } |
OLD | NEW |