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

Side by Side Diff: chrome/browser/ui/views/keyboard_overlay_delegate.cc

Issue 10540123: Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/keyboard_overlay_delegate.h" 5 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 views::Widget* widget = new views::Widget; 75 views::Widget* widget = new views::Widget;
76 views::Widget::InitParams params( 76 views::Widget::InitParams params(
77 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 77 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
78 params.delegate = view; 78 params.delegate = view;
79 widget->Init(params); 79 widget->Init(params);
80 80
81 // Show the widget at the bottom of the work area. 81 // Show the widget at the bottom of the work area.
82 gfx::Size size; 82 gfx::Size size;
83 GetDialogSize(&size); 83 GetDialogSize(&size);
84 const gfx::Rect& rect = gfx::Screen::GetMonitorNearestWindow( 84 const gfx::Rect& rect = gfx::Screen::GetDisplayNearestWindow(
85 widget->GetNativeView()).work_area(); 85 widget->GetNativeView()).work_area();
86 gfx::Rect bounds((rect.width() - size.width()) / 2, 86 gfx::Rect bounds((rect.width() - size.width()) / 2,
87 rect.height() - size.height(), 87 rect.height() - size.height(),
88 size.width(), 88 size.width(),
89 size.height()); 89 size.height());
90 widget->SetBounds(bounds); 90 widget->SetBounds(bounds);
91 91
92 // The widget will be shown when the web contents gets ready to display. 92 // The widget will be shown when the web contents gets ready to display.
93 } 93 }
94 94
(...skipping 12 matching lines...) Expand all
107 107
108 void KeyboardOverlayDelegate::GetWebUIMessageHandlers( 108 void KeyboardOverlayDelegate::GetWebUIMessageHandlers(
109 std::vector<WebUIMessageHandler*>* handlers) const { 109 std::vector<WebUIMessageHandler*>* handlers) const {
110 handlers->push_back(new PaintMessageHandler(view_->GetWidget())); 110 handlers->push_back(new PaintMessageHandler(view_->GetWidget()));
111 } 111 }
112 112
113 void KeyboardOverlayDelegate::GetDialogSize( 113 void KeyboardOverlayDelegate::GetDialogSize(
114 gfx::Size* size) const { 114 gfx::Size* size) const {
115 using std::min; 115 using std::min;
116 DCHECK(view_); 116 DCHECK(view_);
117 gfx::Rect rect = gfx::Screen::GetMonitorNearestWindow( 117 gfx::Rect rect = gfx::Screen::GetDisplayNearestWindow(
118 view_->GetWidget()->GetNativeView()).bounds(); 118 view_->GetWidget()->GetNativeView()).bounds();
119 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); 119 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin);
120 const int height = width * kBaseHeight / kBaseWidth; 120 const int height = width * kBaseHeight / kBaseWidth;
121 size->SetSize(width, height); 121 size->SetSize(width, height);
122 } 122 }
123 123
124 std::string KeyboardOverlayDelegate::GetDialogArgs() const { 124 std::string KeyboardOverlayDelegate::GetDialogArgs() const {
125 return "[]"; 125 return "[]";
126 } 126 }
127 127
128 void KeyboardOverlayDelegate::OnDialogClosed( 128 void KeyboardOverlayDelegate::OnDialogClosed(
129 const std::string& json_retval) { 129 const std::string& json_retval) {
130 delete this; 130 delete this;
131 return; 131 return;
132 } 132 }
133 133
134 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source, 134 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source,
135 bool* out_close_dialog) { 135 bool* out_close_dialog) {
136 } 136 }
137 137
138 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { 138 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const {
139 return false; 139 return false;
140 } 140 }
141 141
142 bool KeyboardOverlayDelegate::HandleContextMenu( 142 bool KeyboardOverlayDelegate::HandleContextMenu(
143 const content::ContextMenuParams& params) { 143 const content::ContextMenuParams& params) {
144 return true; 144 return true;
145 } 145 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/fullscreen_exit_bubble_views.cc ('k') | chrome/browser/ui/views/status_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698