Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: ui/keyboard/content/keyboard_ui_content.cc

Issue 2596743002: Replace WM shadow types (on/off) and styles (small/inactive/active) (Closed)
Patch Set: one more mechanical change Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/shell_surface_unittest.cc ('k') | ui/views/bubble/tray_bubble_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/keyboard/content/keyboard_ui_content.h" 5 #include "ui/keyboard/content/keyboard_ui_content.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/browser/render_widget_host.h" 10 #include "content/public/browser/render_widget_host.h"
11 #include "content/public/browser/render_widget_host_iterator.h" 11 #include "content/public/browser/render_widget_host_iterator.h"
12 #include "content/public/browser/render_widget_host_view.h" 12 #include "content/public/browser/render_widget_host_view.h"
13 #include "content/public/browser/site_instance.h" 13 #include "content/public/browser/site_instance.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_delegate.h" 16 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
18 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
19 #include "content/public/common/bindings_policy.h" 19 #include "content/public/common/bindings_policy.h"
20 #include "ui/aura/layout_manager.h" 20 #include "ui/aura/layout_manager.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/base/ime/input_method.h" 22 #include "ui/base/ime/input_method.h"
23 #include "ui/base/ime/text_input_client.h" 23 #include "ui/base/ime/text_input_client.h"
24 #include "ui/keyboard/content/keyboard_constants.h" 24 #include "ui/keyboard/content/keyboard_constants.h"
25 #include "ui/keyboard/keyboard_controller.h" 25 #include "ui/keyboard/keyboard_controller.h"
26 #include "ui/keyboard/keyboard_switches.h" 26 #include "ui/keyboard/keyboard_switches.h"
27 #include "ui/keyboard/keyboard_util.h" 27 #include "ui/keyboard/keyboard_util.h"
28 #include "ui/wm/core/shadow.h" 28 #include "ui/wm/core/shadow.h"
29 #include "ui/wm/core/shadow_types.h"
29 30
30 namespace { 31 namespace {
31 32
32 // The WebContentsDelegate for the keyboard. 33 // The WebContentsDelegate for the keyboard.
33 // The delegate deletes itself when the keyboard is destroyed. 34 // The delegate deletes itself when the keyboard is destroyed.
34 class KeyboardContentsDelegate : public content::WebContentsDelegate, 35 class KeyboardContentsDelegate : public content::WebContentsDelegate,
35 public content::WebContentsObserver { 36 public content::WebContentsObserver {
36 public: 37 public:
37 explicit KeyboardContentsDelegate(keyboard::KeyboardUIContent* ui) 38 explicit KeyboardContentsDelegate(keyboard::KeyboardUIContent* ui)
38 : ui_(ui) {} 39 : ui_(ui) {}
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 275 }
275 276
276 void KeyboardUIContent::SetupWebContents(content::WebContents* contents) { 277 void KeyboardUIContent::SetupWebContents(content::WebContents* contents) {
277 } 278 }
278 279
279 void KeyboardUIContent::OnWindowBoundsChanged(aura::Window* window, 280 void KeyboardUIContent::OnWindowBoundsChanged(aura::Window* window,
280 const gfx::Rect& old_bounds, 281 const gfx::Rect& old_bounds,
281 const gfx::Rect& new_bounds) { 282 const gfx::Rect& new_bounds) {
282 if (!shadow_) { 283 if (!shadow_) {
283 shadow_.reset(new wm::Shadow()); 284 shadow_.reset(new wm::Shadow());
284 shadow_->Init(wm::Shadow::STYLE_ACTIVE); 285 shadow_->Init(wm::ShadowElevation::LARGE);
285 shadow_->layer()->SetVisible(true); 286 shadow_->layer()->SetVisible(true);
286 DCHECK(keyboard_contents_->GetNativeView()->parent()); 287 DCHECK(keyboard_contents_->GetNativeView()->parent());
287 keyboard_contents_->GetNativeView()->parent()->layer()->Add( 288 keyboard_contents_->GetNativeView()->parent()->layer()->Add(
288 shadow_->layer()); 289 shadow_->layer());
289 } 290 }
290 291
291 shadow_->SetContentBounds(new_bounds); 292 shadow_->SetContentBounds(new_bounds);
292 } 293 }
293 294
294 void KeyboardUIContent::OnWindowDestroyed(aura::Window* window) { 295 void KeyboardUIContent::OnWindowDestroyed(aura::Window* window) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 keyboard_controller()->keyboard_visible()); 329 keyboard_controller()->keyboard_visible());
329 } 330 }
330 331
331 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { 332 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) {
332 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; 333 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr;
333 if (target_window) 334 if (target_window)
334 window_bounds_observer_->AddObservedWindow(target_window); 335 window_bounds_observer_->AddObservedWindow(target_window);
335 } 336 }
336 337
337 } // namespace keyboard 338 } // namespace keyboard
OLDNEW
« no previous file with comments | « components/exo/shell_surface_unittest.cc ('k') | ui/views/bubble/tray_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698