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

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

Issue 7189019: Fix even more crashes. To help identify remaining crashes now and in the future, I have made the ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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) 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/webui/constrained_html_ui.h" 5 #include "chrome/browser/ui/webui/constrained_html_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 8 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
9 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" 9 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h"
10 #include "chrome/browser/ui/webui/html_dialog_ui.h" 10 #include "chrome/browser/ui/webui/html_dialog_ui.h"
11 #include "content/browser/tab_contents/tab_contents.h" 11 #include "content/browser/tab_contents/tab_contents.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
13 #include "views/view.h" 13 #include "views/view.h"
14 #include "views/widget/widget_delegate.h" 14 #include "views/widget/widget_delegate.h"
15 15
16 class ConstrainedHtmlDelegateWin : public TabContentsContainer, 16 class ConstrainedHtmlDelegateWin : public TabContentsContainer,
17 public ConstrainedHtmlUIDelegate, 17 public ConstrainedHtmlUIDelegate,
18 public ConstrainedWindowDelegate, 18 public ConstrainedWindowDelegate,
19 public HtmlDialogTabContentsDelegate { 19 public HtmlDialogTabContentsDelegate {
20 public: 20 public:
21 ConstrainedHtmlDelegateWin(Profile* profile, 21 ConstrainedHtmlDelegateWin(Profile* profile,
22 HtmlDialogUIDelegate* delegate); 22 HtmlDialogUIDelegate* delegate);
23 ~ConstrainedHtmlDelegateWin(); 23 ~ConstrainedHtmlDelegateWin();
24 24
25 // ConstrainedHtmlUIDelegate interface. 25 // ConstrainedHtmlUIDelegate interface.
26 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); 26 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() OVERRIDE;
27 virtual void OnDialogClose(); 27 virtual void OnDialogClose() OVERRIDE;
28 28
29 // ConstrainedWindowDelegate (aka views::WidgetDelegate) interface. 29 // ConstrainedWindowDelegate (aka views::WidgetDelegate) interface.
30 virtual bool CanResize() const { return true; } 30 virtual bool CanResize() const OVERRIDE { return true; }
31 virtual views::View* GetContentsView() { 31 virtual views::View* GetContentsView() {
32 return this; 32 return this;
33 } 33 }
34 virtual void WindowClosing() { 34 virtual void WindowClosing() OVERRIDE {
35 html_delegate_->OnWindowClosed(); 35 html_delegate_->OnWindowClosed();
36 html_delegate_->OnDialogClosed(""); 36 html_delegate_->OnDialogClosed("");
37 } 37 }
38 virtual views::Widget* GetWidget() OVERRIDE {
39 return View::GetWidget();
40 }
41 virtual const views::Widget* GetWidget() const OVERRIDE {
42 return View::GetWidget();
43 }
38 44
39 // HtmlDialogTabContentsDelegate interface. 45 // HtmlDialogTabContentsDelegate interface.
40 void MoveContents(TabContents* source, const gfx::Rect& pos) {} 46 void MoveContents(TabContents* source, const gfx::Rect& pos) OVERRIDE {}
41 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} 47 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE {}
42 48
43 // Overridden from TabContentsContainer. 49 // Overridden from TabContentsContainer.
44 virtual gfx::Size GetPreferredSize() { 50 virtual gfx::Size GetPreferredSize() OVERRIDE {
45 gfx::Size size; 51 gfx::Size size;
46 html_delegate_->GetDialogSize(&size); 52 html_delegate_->GetDialogSize(&size);
47 return size; 53 return size;
48 } 54 }
49 55
50 virtual void ViewHierarchyChanged(bool is_add, 56 virtual void ViewHierarchyChanged(bool is_add,
51 views::View* parent, 57 views::View* parent,
52 views::View* child) { 58 views::View* child) OVERRIDE {
53 TabContentsContainer::ViewHierarchyChanged(is_add, parent, child); 59 TabContentsContainer::ViewHierarchyChanged(is_add, parent, child);
54 if (is_add && child == this) { 60 if (is_add && child == this) {
55 ChangeTabContents(&html_tab_contents_); 61 ChangeTabContents(&html_tab_contents_);
56 } 62 }
57 } 63 }
58 64
59 void set_window(ConstrainedWindow* window) { 65 void set_window(ConstrainedWindow* window) {
60 window_ = window; 66 window_ = window;
61 } 67 }
62 68
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 Profile* profile, 109 Profile* profile,
104 HtmlDialogUIDelegate* delegate, 110 HtmlDialogUIDelegate* delegate,
105 TabContents* container) { 111 TabContents* container) {
106 ConstrainedHtmlDelegateWin* constrained_delegate = 112 ConstrainedHtmlDelegateWin* constrained_delegate =
107 new ConstrainedHtmlDelegateWin(profile, delegate); 113 new ConstrainedHtmlDelegateWin(profile, delegate);
108 ConstrainedWindow* constrained_window = 114 ConstrainedWindow* constrained_window =
109 container->CreateConstrainedDialog(constrained_delegate); 115 container->CreateConstrainedDialog(constrained_delegate);
110 constrained_delegate->set_window(constrained_window); 116 constrained_delegate->set_window(constrained_window);
111 return constrained_window; 117 return constrained_window;
112 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698