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

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

Issue 10204002: Revert 133467 - Convert the last users of DOMView to WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 11 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
12 #include "chrome/browser/ui/views/html_dialog_view.h" 12 #include "chrome/browser/ui/views/html_dialog_view.h"
13 #include "chrome/browser/ui/webui/html_dialog_ui.h" 13 #include "chrome/browser/ui/webui/html_dialog_ui.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/gfx/screen.h" 17 #include "ui/gfx/screen.h"
18 #include "ui/views/widget/widget.h"
19 18
20 using content::WebContents; 19 using content::WebContents;
21 using content::WebUIMessageHandler; 20 using content::WebUIMessageHandler;
22 21
23 namespace { 22 namespace {
24 23
25 const int kBaseWidth = 1252; 24 const int kBaseWidth = 1252;
26 const int kBaseHeight = 516; 25 const int kBaseHeight = 516;
27 const int kHorizontalMargin = 28; 26 const int kHorizontalMargin = 28;
28 27
(...skipping 22 matching lines...) Expand all
51 50
52 void KeyboardOverlayDelegate::GetWebUIMessageHandlers( 51 void KeyboardOverlayDelegate::GetWebUIMessageHandlers(
53 std::vector<WebUIMessageHandler*>* handlers) const { 52 std::vector<WebUIMessageHandler*>* handlers) const {
54 } 53 }
55 54
56 void KeyboardOverlayDelegate::GetDialogSize( 55 void KeyboardOverlayDelegate::GetDialogSize(
57 gfx::Size* size) const { 56 gfx::Size* size) const {
58 using std::min; 57 using std::min;
59 DCHECK(view_); 58 DCHECK(view_);
60 gfx::Rect rect = gfx::Screen::GetMonitorAreaNearestWindow( 59 gfx::Rect rect = gfx::Screen::GetMonitorAreaNearestWindow(
61 view_->GetWidget()->GetNativeView()); 60 view_->native_view());
62 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); 61 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin);
63 const int height = width * kBaseHeight / kBaseWidth; 62 const int height = width * kBaseHeight / kBaseWidth;
64 size->SetSize(width, height); 63 size->SetSize(width, height);
65 } 64 }
66 65
67 std::string KeyboardOverlayDelegate::GetDialogArgs() const { 66 std::string KeyboardOverlayDelegate::GetDialogArgs() const {
68 return "[]"; 67 return "[]";
69 } 68 }
70 69
71 void KeyboardOverlayDelegate::OnDialogClosed( 70 void KeyboardOverlayDelegate::OnDialogClosed(
72 const std::string& json_retval) { 71 const std::string& json_retval) {
73 // Re-enable Shift+Alt. crosbug.com/17208. 72 // Re-enable Shift+Alt. crosbug.com/17208.
74 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys(); 73 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys();
75 delete this; 74 delete this;
76 return; 75 return;
77 } 76 }
78 77
79 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source, 78 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source,
80 bool* out_close_dialog) { 79 bool* out_close_dialog) {
81 } 80 }
82 81
83 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { 82 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const {
84 return false; 83 return false;
85 } 84 }
86 85
87 bool KeyboardOverlayDelegate::HandleContextMenu( 86 bool KeyboardOverlayDelegate::HandleContextMenu(
88 const content::ContextMenuParams& params) { 87 const content::ContextMenuParams& params) {
89 return true; 88 return true;
90 } 89 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/html_dialog_view_browsertest.cc ('k') | chrome/browser/ui/views/keyboard_overlay_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698