OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
| 7 #include "ash/frame/caption_buttons/frame_caption_button.h" |
| 8 #include "ash/frame/custom_frame_view_ash.h" |
7 #include "ash/shell.h" | 9 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
12 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
13 #include "components/exo/surface.h" | 15 #include "components/exo/surface.h" |
| 16 #include "grit/ash_resources.h" |
14 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
15 #include "ui/base/hit_test.h" | 18 #include "ui/base/hit_test.h" |
16 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
17 | 20 |
18 namespace exo { | 21 namespace exo { |
19 namespace { | 22 namespace { |
20 | 23 |
21 class CustomFrameView : public views::NonClientFrameView { | 24 class CustomFrameView : public ash::CustomFrameViewAsh, |
| 25 public views::ButtonListener { |
22 public: | 26 public: |
23 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} | 27 explicit CustomFrameView(views::Widget* widget) |
| 28 : ash::CustomFrameViewAsh(widget) { |
| 29 ash::FrameCaptionButton* back_button = |
| 30 new ash::FrameCaptionButton(this, ash::CAPTION_BUTTON_ICON_BACK); |
| 31 back_button->SetImages( |
| 32 ash::CAPTION_BUTTON_ICON_BACK, ash::FrameCaptionButton::ANIMATE_NO, |
| 33 IDR_AURA_WINDOW_CONTROL_ICON_BACK, IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, |
| 34 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); |
| 35 SetLeftCaptionButton(back_button); |
| 36 } |
24 ~CustomFrameView() override {} | 37 ~CustomFrameView() override {} |
25 | 38 |
26 // Overridden from views::NonClientFrameView: | 39 // Overridden from views::ButtonListener: |
27 gfx::Rect GetBoundsForClientView() const override { return bounds(); } | 40 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
28 gfx::Rect GetWindowBoundsForClientBounds( | 41 NOTIMPLEMENTED(); |
29 const gfx::Rect& client_bounds) const override { | |
30 return client_bounds; | |
31 } | 42 } |
32 int NonClientHitTest(const gfx::Point& point) override { | |
33 return widget_->client_view()->NonClientHitTest(point); | |
34 } | |
35 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {} | |
36 void ResetWindowControls() override {} | |
37 void UpdateWindowIcon() override {} | |
38 void UpdateWindowTitle() override {} | |
39 void SizeConstraintsChanged() override {} | |
40 | 43 |
41 private: | 44 private: |
42 views::Widget* const widget_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); | 45 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace | 48 } // namespace |
48 | 49 |
49 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
50 // ShellSurface, public: | 51 // ShellSurface, public: |
51 | 52 |
52 ShellSurface::ShellSurface(Surface* surface) | 53 ShellSurface::ShellSurface(Surface* surface) |
53 : surface_(surface), show_state_(ui::SHOW_STATE_END) { | 54 : surface_(surface), show_state_(ui::SHOW_STATE_END) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 views::View* ShellSurface::GetContentsView() { | 174 views::View* ShellSurface::GetContentsView() { |
174 return surface_; | 175 return surface_; |
175 } | 176 } |
176 | 177 |
177 views::NonClientFrameView* ShellSurface::CreateNonClientFrameView( | 178 views::NonClientFrameView* ShellSurface::CreateNonClientFrameView( |
178 views::Widget* widget) { | 179 views::Widget* widget) { |
179 return new CustomFrameView(widget); | 180 return new CustomFrameView(widget); |
180 } | 181 } |
181 | 182 |
182 } // namespace exo | 183 } // namespace exo |
OLD | NEW |