OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Return a vector of non-draggable regions that fill a window of size | 73 // Return a vector of non-draggable regions that fill a window of size |
74 // |width| by |height|, but leave gaps where the window should be draggable. | 74 // |width| by |height|, but leave gaps where the window should be draggable. |
75 std::vector<gfx::Rect> CalculateNonDraggableRegions( | 75 std::vector<gfx::Rect> CalculateNonDraggableRegions( |
76 const std::vector<extensions::DraggableRegion>& regions, | 76 const std::vector<extensions::DraggableRegion>& regions, |
77 int width, | 77 int width, |
78 int height) { | 78 int height) { |
79 std::vector<gfx::Rect> result; | 79 std::vector<gfx::Rect> result; |
80 if (regions.empty()) { | 80 if (regions.empty()) { |
81 result.push_back(gfx::Rect(0, 0, width, height)); | 81 result.push_back(gfx::Rect(0, 0, width, height)); |
82 } else { | 82 } else { |
83 scoped_ptr<SkRegion> draggable( | 83 std::unique_ptr<SkRegion> draggable( |
84 AppWindow::RawDraggableRegionsToSkRegion(regions)); | 84 AppWindow::RawDraggableRegionsToSkRegion(regions)); |
85 scoped_ptr<SkRegion> non_draggable(new SkRegion); | 85 std::unique_ptr<SkRegion> non_draggable(new SkRegion); |
86 non_draggable->op(0, 0, width, height, SkRegion::kUnion_Op); | 86 non_draggable->op(0, 0, width, height, SkRegion::kUnion_Op); |
87 non_draggable->op(*draggable, SkRegion::kDifference_Op); | 87 non_draggable->op(*draggable, SkRegion::kDifference_Op); |
88 for (SkRegion::Iterator it(*non_draggable); !it.done(); it.next()) { | 88 for (SkRegion::Iterator it(*non_draggable); !it.done(); it.next()) { |
89 result.push_back(gfx::SkIRectToRect(it.rect())); | 89 result.push_back(gfx::SkIRectToRect(it.rect())); |
90 } | 90 } |
91 } | 91 } |
92 return result; | 92 return result; |
93 } | 93 } |
94 | 94 |
95 } // namespace | 95 } // namespace |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 void NativeAppWindowCocoa::UpdateWindowIcon() { | 533 void NativeAppWindowCocoa::UpdateWindowIcon() { |
534 // TODO(junmin): implement. | 534 // TODO(junmin): implement. |
535 } | 535 } |
536 | 536 |
537 void NativeAppWindowCocoa::UpdateWindowTitle() { | 537 void NativeAppWindowCocoa::UpdateWindowTitle() { |
538 base::string16 title = app_window_->GetTitle(); | 538 base::string16 title = app_window_->GetTitle(); |
539 [window() setTitle:base::SysUTF16ToNSString(title)]; | 539 [window() setTitle:base::SysUTF16ToNSString(title)]; |
540 } | 540 } |
541 | 541 |
542 void NativeAppWindowCocoa::UpdateShape(scoped_ptr<SkRegion> region) { | 542 void NativeAppWindowCocoa::UpdateShape(std::unique_ptr<SkRegion> region) { |
543 NOTIMPLEMENTED(); | 543 NOTIMPLEMENTED(); |
544 } | 544 } |
545 | 545 |
546 void NativeAppWindowCocoa::UpdateDraggableRegions( | 546 void NativeAppWindowCocoa::UpdateDraggableRegions( |
547 const std::vector<extensions::DraggableRegion>& regions) { | 547 const std::vector<extensions::DraggableRegion>& regions) { |
548 // Draggable region is not supported for non-frameless window. | 548 // Draggable region is not supported for non-frameless window. |
549 if (has_frame_) | 549 if (has_frame_) |
550 return; | 550 return; |
551 | 551 |
552 draggable_regions_ = regions; | 552 draggable_regions_ = regions; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 } | 832 } |
833 | 833 |
834 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 834 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
835 if (IsRestored(*this)) | 835 if (IsRestored(*this)) |
836 restored_bounds_ = [window() frame]; | 836 restored_bounds_ = [window() frame]; |
837 } | 837 } |
838 | 838 |
839 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 839 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
840 [window() orderOut:window_controller_]; | 840 [window() orderOut:window_controller_]; |
841 } | 841 } |
OLD | NEW |