OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ime/ime_window.h" | 5 #include "chrome/browser/ui/ime/ime_window.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/ime/ime_native_window.h" | 11 #include "chrome/browser/ui/ime/ime_native_window.h" |
12 #include "chrome/browser/ui/ime/ime_window_observer.h" | 12 #include "chrome/browser/ui/ime/ime_window_observer.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "extensions/common/constants.h" | 17 #include "extensions/common/constants.h" |
18 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
19 #include "extensions/common/manifest_handlers/icons_handler.h" | 19 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 20 #include "ui/display/screen.h" |
20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
21 #include "ui/gfx/screen.h" | |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // The vertical margin between the cursor and the follow-cursor window. | 25 // The vertical margin between the cursor and the follow-cursor window. |
26 const int kFollowCursorMargin = 3; | 26 const int kFollowCursorMargin = 3; |
27 | 27 |
28 // The offset from the left of follow cursor window to the left of cursor. | 28 // The offset from the left of follow cursor window to the left of cursor. |
29 const int kFollowCursorOffset = 32; | 29 const int kFollowCursorOffset = 32; |
30 | 30 |
31 } // namespace | 31 } // namespace |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 void ImeWindow::SetBounds(const gfx::Rect& bounds) { | 93 void ImeWindow::SetBounds(const gfx::Rect& bounds) { |
94 native_window_->SetBounds(bounds); | 94 native_window_->SetBounds(bounds); |
95 } | 95 } |
96 | 96 |
97 void ImeWindow::FollowCursor(const gfx::Rect& cursor_bounds) { | 97 void ImeWindow::FollowCursor(const gfx::Rect& cursor_bounds) { |
98 if (mode_ != FOLLOW_CURSOR) | 98 if (mode_ != FOLLOW_CURSOR) |
99 return; | 99 return; |
100 | 100 |
101 gfx::Rect screen_bounds = | 101 gfx::Rect screen_bounds = |
102 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 102 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
103 gfx::Rect window_bounds = native_window_->GetBounds(); | 103 gfx::Rect window_bounds = native_window_->GetBounds(); |
104 int screen_width = screen_bounds.width(); | 104 int screen_width = screen_bounds.width(); |
105 int screen_height = screen_bounds.height(); | 105 int screen_height = screen_bounds.height(); |
106 int width = window_bounds.width(); | 106 int width = window_bounds.width(); |
107 int height = window_bounds.height(); | 107 int height = window_bounds.height(); |
108 // By default, aligns the left of the window client area to the left of the | 108 // By default, aligns the left of the window client area to the left of the |
109 // cursor, and aligns the top of the window to the bottom of the cursor. | 109 // cursor, and aligns the top of the window to the bottom of the cursor. |
110 // If the right of the window would go beyond the screen bounds, aligns the | 110 // If the right of the window would go beyond the screen bounds, aligns the |
111 // right of the window to the screen bounds. | 111 // right of the window to the screen bounds. |
112 // If the bottom of the window would go beyond the screen bounds, aligns the | 112 // If the bottom of the window would go beyond the screen bounds, aligns the |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bounds.set_width(pos.width()); | 189 bounds.set_width(pos.width()); |
190 bounds.set_height(pos.height()); | 190 bounds.set_height(pos.height()); |
191 native_window_->SetBounds(bounds); | 191 native_window_->SetBounds(bounds); |
192 } | 192 } |
193 | 193 |
194 bool ImeWindow::IsPopupOrPanel(const content::WebContents* source) const { | 194 bool ImeWindow::IsPopupOrPanel(const content::WebContents* source) const { |
195 return true; | 195 return true; |
196 } | 196 } |
197 | 197 |
198 } // namespace ui | 198 } // namespace ui |
OLD | NEW |