| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 delegate_->GetWebUIMessageHandlers(handlers); | 173 delegate_->GetWebUIMessageHandlers(handlers); |
| 173 } else { | 174 } else { |
| 174 // TODO(akalin): Add this clause in the windows version. Also | 175 // TODO(akalin): Add this clause in the windows version. Also |
| 175 // make sure that everything expects handlers to be non-NULL and | 176 // make sure that everything expects handlers to be non-NULL and |
| 176 // document it. | 177 // document it. |
| 177 handlers->clear(); | 178 handlers->clear(); |
| 178 } | 179 } |
| 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 } |
| 188 |
| 189 void HtmlDialogWindowDelegateBridge::GetMinimumDialogSize( |
| 190 gfx::Size* size) const { |
| 191 if (delegate_) |
| 192 delegate_->GetMinimumDialogSize(size); |
| 193 else |
| 194 *size = gfx::Size(); |
| 187 } | 195 } |
| 188 | 196 |
| 189 std::string HtmlDialogWindowDelegateBridge::GetDialogArgs() const { | 197 std::string HtmlDialogWindowDelegateBridge::GetDialogArgs() const { |
| 190 return delegate_ ? delegate_->GetDialogArgs() : ""; | 198 return delegate_ ? delegate_->GetDialogArgs() : ""; |
| 191 } | 199 } |
| 192 | 200 |
| 193 void HtmlDialogWindowDelegateBridge::OnDialogClosed( | 201 void HtmlDialogWindowDelegateBridge::OnDialogClosed( |
| 194 const std::string& json_retval) { | 202 const std::string& json_retval) { |
| 195 Detach(); | 203 Detach(); |
| 196 // [controller_ close] should be called at most once, too. | 204 // [controller_ close] should be called at most once, too. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 372 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 365 // to do the above doesn't work. | 373 // to do the above doesn't work. |
| 366 } | 374 } |
| 367 | 375 |
| 368 - (void)windowWillClose:(NSNotification*)notification { | 376 - (void)windowWillClose:(NSNotification*)notification { |
| 369 delegate_->WindowControllerClosed(); | 377 delegate_->WindowControllerClosed(); |
| 370 [self autorelease]; | 378 [self autorelease]; |
| 371 } | 379 } |
| 372 | 380 |
| 373 @end | 381 @end |
| OLD | NEW |