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

Side by Side Diff: ash/content/keyboard_overlay/keyboard_overlay_delegate.cc

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 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
OLDNEW
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 "ash/content/keyboard_overlay/keyboard_overlay_delegate.h" 5 #include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 views::Widget::InitParams params( 70 views::Widget::InitParams params(
71 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 71 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
72 params.context = Shell::GetPrimaryRootWindow(); 72 params.context = Shell::GetPrimaryRootWindow();
73 params.delegate = view; 73 params.delegate = view;
74 widget_->Init(params); 74 widget_->Init(params);
75 75
76 // Show the widget at the bottom of the work area. 76 // Show the widget at the bottom of the work area.
77 gfx::Size size; 77 gfx::Size size;
78 GetDialogSize(&size); 78 GetDialogSize(&size);
79 const gfx::Rect& rect = 79 const gfx::Rect& rect =
80 Shell::GetScreen() 80 gfx::Screen::GetScreen()
81 ->GetDisplayNearestWindow(widget_->GetNativeView()) 81 ->GetDisplayNearestWindow(widget_->GetNativeView())
82 .work_area(); 82 .work_area();
83 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2, 83 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2,
84 rect.bottom() - size.height(), size.width(), size.height()); 84 rect.bottom() - size.height(), size.width(), size.height());
85 widget_->SetBounds(bounds); 85 widget_->SetBounds(bounds);
86 86
87 // The widget will be shown when the web contents gets ready to display. 87 // The widget will be shown when the web contents gets ready to display.
88 return widget_; 88 return widget_;
89 } 89 }
90 90
(...skipping 10 matching lines...) Expand all
101 } 101 }
102 102
103 void KeyboardOverlayDelegate::GetWebUIMessageHandlers( 103 void KeyboardOverlayDelegate::GetWebUIMessageHandlers(
104 std::vector<WebUIMessageHandler*>* handlers) const { 104 std::vector<WebUIMessageHandler*>* handlers) const {
105 handlers->push_back(new PaintMessageHandler(widget_)); 105 handlers->push_back(new PaintMessageHandler(widget_));
106 } 106 }
107 107
108 void KeyboardOverlayDelegate::GetDialogSize(gfx::Size* size) const { 108 void KeyboardOverlayDelegate::GetDialogSize(gfx::Size* size) const {
109 using std::min; 109 using std::min;
110 DCHECK(widget_); 110 DCHECK(widget_);
111 gfx::Rect rect = ash::Shell::GetScreen() 111 gfx::Rect rect = gfx::Screen::GetScreen()
112 ->GetDisplayNearestWindow(widget_->GetNativeView()) 112 ->GetDisplayNearestWindow(widget_->GetNativeView())
113 .work_area(); 113 .work_area();
114 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); 114 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin);
115 const int height = width * kBaseHeight / kBaseWidth; 115 const int height = width * kBaseHeight / kBaseWidth;
116 size->SetSize(width, height); 116 size->SetSize(width, height);
117 } 117 }
118 118
119 std::string KeyboardOverlayDelegate::GetDialogArgs() const { 119 std::string KeyboardOverlayDelegate::GetDialogArgs() const {
120 return "[]"; 120 return "[]";
121 } 121 }
122 122
123 void KeyboardOverlayDelegate::OnDialogClosed(const std::string& json_retval) { 123 void KeyboardOverlayDelegate::OnDialogClosed(const std::string& json_retval) {
124 delete this; 124 delete this;
125 return; 125 return;
126 } 126 }
127 127
128 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source, 128 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source,
129 bool* out_close_dialog) {} 129 bool* out_close_dialog) {}
130 130
131 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { 131 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const {
132 return false; 132 return false;
133 } 133 }
134 134
135 bool KeyboardOverlayDelegate::HandleContextMenu( 135 bool KeyboardOverlayDelegate::HandleContextMenu(
136 const content::ContextMenuParams& params) { 136 const content::ContextMenuParams& params) {
137 return true; 137 return true;
138 } 138 }
139 139
140 } // namespace ash 140 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698