Chromium Code Reviews| 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 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 // button or from an accelerator. | 44 // button or from an accelerator. |
| 45 void WindowControllerClosed(); | 45 void WindowControllerClosed(); |
| 46 | 46 |
| 47 // HtmlDialogUIDelegate declarations. | 47 // HtmlDialogUIDelegate declarations. |
| 48 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | 48 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
| 49 virtual string16 GetDialogTitle() const OVERRIDE; | 49 virtual string16 GetDialogTitle() const OVERRIDE; |
| 50 virtual GURL GetDialogContentURL() const OVERRIDE; | 50 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 51 virtual void GetWebUIMessageHandlers( | 51 virtual void GetWebUIMessageHandlers( |
| 52 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 52 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 53 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 53 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 54 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE; | |
| 54 virtual std::string GetDialogArgs() const OVERRIDE; | 55 virtual std::string GetDialogArgs() const OVERRIDE; |
| 55 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 56 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 56 virtual void OnCloseContents(WebContents* source, | 57 virtual void OnCloseContents(WebContents* source, |
| 57 bool* out_close_dialog) OVERRIDE; | 58 bool* out_close_dialog) OVERRIDE; |
| 58 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } | 59 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } |
| 59 | 60 |
| 60 // HtmlDialogTabContentsDelegate declarations. | 61 // HtmlDialogTabContentsDelegate declarations. |
| 61 virtual void MoveContents(WebContents* source, const gfx::Rect& pos); | 62 virtual void MoveContents(WebContents* source, const gfx::Rect& pos); |
| 62 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 63 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 63 virtual void CloseContents(WebContents* source) OVERRIDE; | 64 virtual void CloseContents(WebContents* source) OVERRIDE; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 } | 180 } |
| 180 | 181 |
| 181 void HtmlDialogWindowDelegateBridge::GetDialogSize(gfx::Size* size) const { | 182 void HtmlDialogWindowDelegateBridge::GetDialogSize(gfx::Size* size) const { |
| 182 if (delegate_) { | 183 if (delegate_) { |
| 183 delegate_->GetDialogSize(size); | 184 delegate_->GetDialogSize(size); |
| 184 } else { | 185 } else { |
| 185 *size = gfx::Size(); | 186 *size = gfx::Size(); |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 | 189 |
| 190 void HtmlDialogWindowDelegateBridge::GetMinimumDialogSize( | |
| 191 gfx::Size* size) const { | |
| 192 if (delegate_) { | |
|
sail
2012/03/01 18:14:59
no braces for single line statements
same above
yoshiki
2012/03/02 06:51:10
Done.
| |
| 193 delegate_->GetMinimumDialogSize(size); | |
| 194 } else { | |
| 195 *size = gfx::Size(); | |
| 196 } | |
| 197 } | |
| 198 | |
| 189 std::string HtmlDialogWindowDelegateBridge::GetDialogArgs() const { | 199 std::string HtmlDialogWindowDelegateBridge::GetDialogArgs() const { |
| 190 return delegate_ ? delegate_->GetDialogArgs() : ""; | 200 return delegate_ ? delegate_->GetDialogArgs() : ""; |
| 191 } | 201 } |
| 192 | 202 |
| 193 void HtmlDialogWindowDelegateBridge::OnDialogClosed( | 203 void HtmlDialogWindowDelegateBridge::OnDialogClosed( |
| 194 const std::string& json_retval) { | 204 const std::string& json_retval) { |
| 195 Detach(); | 205 Detach(); |
| 196 // [controller_ close] should be called at most once, too. | 206 // [controller_ close] should be called at most once, too. |
| 197 if (DelegateOnDialogClosed(json_retval)) { | 207 if (DelegateOnDialogClosed(json_retval)) { |
| 198 [controller_ close]; | 208 [controller_ close]; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 374 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 365 // to do the above doesn't work. | 375 // to do the above doesn't work. |
| 366 } | 376 } |
| 367 | 377 |
| 368 - (void)windowWillClose:(NSNotification*)notification { | 378 - (void)windowWillClose:(NSNotification*)notification { |
| 369 delegate_->WindowControllerClosed(); | 379 delegate_->WindowControllerClosed(); |
| 370 [self autorelease]; | 380 [self autorelease]; |
| 371 } | 381 } |
| 372 | 382 |
| 373 @end | 383 @end |
| OLD | NEW |