OLD | NEW |
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/webui/constrained_web_dialog_delegate_base.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 10 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // contents::WebContentsDelegate: | 118 // contents::WebContentsDelegate: |
119 void HandleKeyboardEvent( | 119 void HandleKeyboardEvent( |
120 content::WebContents* source, | 120 content::WebContents* source, |
121 const content::NativeWebKeyboardEvent& event) override { | 121 const content::NativeWebKeyboardEvent& event) override { |
122 unhandled_keyboard_event_handler_.HandleKeyboardEvent( | 122 unhandled_keyboard_event_handler_.HandleKeyboardEvent( |
123 event, view_->GetFocusManager()); | 123 event, view_->GetFocusManager()); |
124 } | 124 } |
125 | 125 |
126 // ConstrainedWebDialogDelegate: | 126 // ConstrainedWebDialogDelegate: |
127 web_modal::NativeWebContentsModalDialog GetNativeDialog() override { | 127 web_modal::NativeWebContentsModalDialog GetNativeDialog() override { |
128 return view_->GetWidget()->GetNativeView(); | 128 return view_->GetWidget()->GetNativeWindow(); |
129 } | 129 } |
130 | 130 |
131 private: | 131 private: |
132 // Converts keyboard events on the WebContents to accelerators. | 132 // Converts keyboard events on the WebContents to accelerators. |
133 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 133 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
134 | 134 |
135 views::WebView* view_; | 135 views::WebView* view_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViews); | 137 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViews); |
138 }; | 138 }; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (!max_size_.IsEmpty()) | 239 if (!max_size_.IsEmpty()) |
240 EnableAutoResize(); | 240 EnableAutoResize(); |
241 } | 241 } |
242 void DocumentOnLoadCompletedInMainFrame() override { | 242 void DocumentOnLoadCompletedInMainFrame() override { |
243 if (!max_size_.IsEmpty()) { | 243 if (!max_size_.IsEmpty()) { |
244 EnableAutoResize(); | 244 EnableAutoResize(); |
245 if (initiator_observer_.web_contents()) { | 245 if (initiator_observer_.web_contents()) { |
246 web_modal::PopupManager* popup_manager = | 246 web_modal::PopupManager* popup_manager = |
247 web_modal::PopupManager::FromWebContents( | 247 web_modal::PopupManager::FromWebContents( |
248 initiator_observer_.web_contents()); | 248 initiator_observer_.web_contents()); |
249 popup_manager->ShowModalDialog(GetWidget()->GetNativeView(), | 249 popup_manager->ShowModalDialog(GetWidget()->GetNativeWindow(), |
250 initiator_observer_.web_contents()); | 250 initiator_observer_.web_contents()); |
251 } | 251 } |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 private: | 255 private: |
256 void EnableAutoResize() { | 256 void EnableAutoResize() { |
257 content::RenderViewHost* render_view_host = | 257 content::RenderViewHost* render_view_host = |
258 GetWebContents()->GetRenderViewHost(); | 258 GetWebContents()->GetRenderViewHost(); |
259 render_view_host->EnableAutoResize(min_size_, max_size_); | 259 render_view_host->EnableAutoResize(min_size_, max_size_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 const gfx::Size& max_size) { | 292 const gfx::Size& max_size) { |
293 DCHECK(!min_size.IsEmpty()); | 293 DCHECK(!min_size.IsEmpty()); |
294 DCHECK(!max_size.IsEmpty()); | 294 DCHECK(!max_size.IsEmpty()); |
295 ConstrainedWebDialogDelegateViewViews* dialog = | 295 ConstrainedWebDialogDelegateViewViews* dialog = |
296 new ConstrainedWebDialogDelegateViewViews( | 296 new ConstrainedWebDialogDelegateViewViews( |
297 browser_context, delegate, web_contents, | 297 browser_context, delegate, web_contents, |
298 min_size, max_size); | 298 min_size, max_size); |
299 constrained_window::CreateWebModalDialogViews(dialog, web_contents); | 299 constrained_window::CreateWebModalDialogViews(dialog, web_contents); |
300 return dialog; | 300 return dialog; |
301 } | 301 } |
OLD | NEW |