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