OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/html_dialog_view.h" | 5 #include "chrome/browser/ui/views/html_dialog_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
10 #include "chrome/browser/ui/views/window.h" | 10 #include "chrome/browser/ui/views/window.h" |
11 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
12 #include "content/common/native_web_keyboard_event.h" | 12 #include "content/common/native_web_keyboard_event.h" |
| 13 #include "content/common/content_notification_types.h" |
13 #include "content/common/notification_details.h" | 14 #include "content/common/notification_details.h" |
14 #include "content/common/notification_source.h" | 15 #include "content/common/notification_source.h" |
15 #include "content/common/notification_type.h" | |
16 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
17 #include "views/events/event.h" | 17 #include "views/events/event.h" |
18 #include "views/widget/root_view.h" | 18 #include "views/widget/root_view.h" |
19 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
20 | 20 |
21 #if defined(TOOLKIT_USES_GTK) | 21 #if defined(TOOLKIT_USES_GTK) |
22 #include "views/widget/native_widget_gtk.h" | 22 #include "views/widget/native_widget_gtk.h" |
23 #endif | 23 #endif |
24 | 24 |
25 class RenderWidgetHost; | 25 class RenderWidgetHost; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 DOMView::Init(profile(), NULL); | 244 DOMView::Init(profile(), NULL); |
245 | 245 |
246 tab_contents_->set_delegate(this); | 246 tab_contents_->set_delegate(this); |
247 | 247 |
248 // Set the delegate. This must be done before loading the page. See | 248 // Set the delegate. This must be done before loading the page. See |
249 // the comment above HtmlDialogUI in its header file for why. | 249 // the comment above HtmlDialogUI in its header file for why. |
250 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), | 250 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), |
251 this); | 251 this); |
252 notification_registrar_.Add( | 252 notification_registrar_.Add( |
253 this, | 253 this, |
254 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 254 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
255 Source<TabContents>(tab_contents())); | 255 Source<TabContents>(tab_contents())); |
256 notification_registrar_.Add( | 256 notification_registrar_.Add( |
257 this, | 257 this, |
258 NotificationType::LOAD_COMPLETED_MAIN_FRAME, | 258 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
259 Source<TabContents>(tab_contents())); | 259 Source<TabContents>(tab_contents())); |
260 | 260 |
261 DOMView::LoadURL(GetDialogContentURL()); | 261 DOMView::LoadURL(GetDialogContentURL()); |
262 } | 262 } |
263 | 263 |
264 void HtmlDialogView::Observe(NotificationType type, | 264 void HtmlDialogView::Observe(int type, |
265 const NotificationSource& source, | 265 const NotificationSource& source, |
266 const NotificationDetails& details) { | 266 const NotificationDetails& details) { |
267 switch (type.value) { | 267 switch (type) { |
268 case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { | 268 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { |
269 RenderWidgetHost* rwh = Details<RenderWidgetHost>(details).ptr(); | 269 RenderWidgetHost* rwh = Details<RenderWidgetHost>(details).ptr(); |
270 notification_registrar_.Add( | 270 notification_registrar_.Add( |
271 this, | 271 this, |
272 NotificationType::RENDER_WIDGET_HOST_DID_PAINT, | 272 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
273 Source<RenderWidgetHost>(rwh)); | 273 Source<RenderWidgetHost>(rwh)); |
274 break; | 274 break; |
275 } | 275 } |
276 case NotificationType::LOAD_COMPLETED_MAIN_FRAME: | 276 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: |
277 if (state_ == INITIALIZED) | 277 if (state_ == INITIALIZED) |
278 state_ = LOADED; | 278 state_ = LOADED; |
279 break; | 279 break; |
280 case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: | 280 case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: |
281 if (state_ == LOADED) { | 281 if (state_ == LOADED) { |
282 state_ = PAINTED; | 282 state_ = PAINTED; |
283 #if defined(OS_CHROMEOS) | 283 #if defined(OS_CHROMEOS) |
284 views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( | 284 views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( |
285 GTK_WINDOW(GetWidget()->GetNativeView()), false); | 285 GTK_WINDOW(GetWidget()->GetNativeView()), false); |
286 #endif | 286 #endif |
287 } | 287 } |
288 break; | 288 break; |
289 default: | 289 default: |
290 NOTREACHED() << "unknown type" << type.value; | 290 NOTREACHED() << "unknown type" << type; |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 void HtmlDialogView::RegisterDialogAccelerators() { | 294 void HtmlDialogView::RegisterDialogAccelerators() { |
295 // Pressing the ESC key will close the dialog. | 295 // Pressing the ESC key will close the dialog. |
296 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); | 296 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); |
297 } | 297 } |
OLD | NEW |