Chromium Code Reviews| 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/extensions/extension_dialog.h" | 5 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ExtensionDialog::ObserverDestroyed() { | 108 void ExtensionDialog::ObserverDestroyed() { |
| 109 observer_ = NULL; | 109 observer_ = NULL; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ExtensionDialog::Close() { | 112 void ExtensionDialog::Close() { |
| 113 if (!window_) | 113 if (!window_) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 if (observer_) | |
| 117 observer_->ExtensionDialogIsClosing(this); | |
| 118 | |
| 119 window_->Close(); | 116 window_->Close(); |
| 120 window_ = NULL; | 117 window_ = NULL; |
| 121 } | 118 } |
| 122 | 119 |
| 123 ///////////////////////////////////////////////////////////////////////////// | 120 ///////////////////////////////////////////////////////////////////////////// |
| 124 // views::WidgetDelegate overrides. | 121 // views::WidgetDelegate overrides. |
| 125 | 122 |
| 126 bool ExtensionDialog::CanResize() const { | 123 bool ExtensionDialog::CanResize() const { |
| 127 return false; | 124 return false; |
| 128 } | 125 } |
| 129 | 126 |
| 130 bool ExtensionDialog::IsModal() const { | 127 bool ExtensionDialog::IsModal() const { |
| 131 return true; | 128 return true; |
| 132 } | 129 } |
| 133 | 130 |
| 134 bool ExtensionDialog::ShouldShowWindowTitle() const { | 131 bool ExtensionDialog::ShouldShowWindowTitle() const { |
| 135 return !window_title_.empty(); | 132 return !window_title_.empty(); |
| 136 } | 133 } |
| 137 | 134 |
| 138 string16 ExtensionDialog::GetWindowTitle() const { | 135 string16 ExtensionDialog::GetWindowTitle() const { |
| 139 return window_title_; | 136 return window_title_; |
| 140 } | 137 } |
| 141 | 138 |
| 139 void ExtensionDialog::WindowClosing() { | |
| 140 // Cleanup the pending dialog list. | |
|
flackr
2011/11/28 19:47:06
Correct me if I'm wrong, but your comment is speci
bshe
2011/11/28 22:26:50
Done.
It is quite self documenting, so I will just
| |
| 141 if (observer_) | |
| 142 observer_->ExtensionDialogIsClosing(this); | |
| 143 } | |
| 144 | |
| 142 void ExtensionDialog::DeleteDelegate() { | 145 void ExtensionDialog::DeleteDelegate() { |
| 143 // The window has finished closing. Allow ourself to be deleted. | 146 // The window has finished closing. Allow ourself to be deleted. |
| 144 Release(); | 147 Release(); |
| 145 } | 148 } |
| 146 | 149 |
| 147 views::Widget* ExtensionDialog::GetWidget() { | 150 views::Widget* ExtensionDialog::GetWidget() { |
| 148 return extension_host_->view()->GetWidget(); | 151 return extension_host_->view()->GetWidget(); |
| 149 } | 152 } |
| 150 | 153 |
| 151 const views::Widget* ExtensionDialog::GetWidget() const { | 154 const views::Widget* ExtensionDialog::GetWidget() const { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 167 // If we aren't the host of the popup, then disregard the notification. | 170 // If we aren't the host of the popup, then disregard the notification. |
| 168 if (content::Details<ExtensionHost>(host()) != details) | 171 if (content::Details<ExtensionHost>(host()) != details) |
| 169 return; | 172 return; |
| 170 Close(); | 173 Close(); |
| 171 break; | 174 break; |
| 172 default: | 175 default: |
| 173 NOTREACHED() << L"Received unexpected notification"; | 176 NOTREACHED() << L"Received unexpected notification"; |
| 174 break; | 177 break; |
| 175 } | 178 } |
| 176 } | 179 } |
| OLD | NEW |