| 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/web_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/web_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/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #import "chrome/browser/ui/browser_dialogs.h" | 10 #import "chrome/browser/ui/browser_dialogs.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } | 67 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } |
| 68 | 68 |
| 69 // WebDialogWebContentsDelegate declarations. | 69 // WebDialogWebContentsDelegate declarations. |
| 70 virtual void MoveContents(WebContents* source, const gfx::Rect& pos); | 70 virtual void MoveContents(WebContents* source, const gfx::Rect& pos); |
| 71 virtual void HandleKeyboardEvent(content::WebContents* source, | 71 virtual void HandleKeyboardEvent(content::WebContents* source, |
| 72 const NativeWebKeyboardEvent& event); | 72 const NativeWebKeyboardEvent& event); |
| 73 virtual void CloseContents(WebContents* source) OVERRIDE; | 73 virtual void CloseContents(WebContents* source) OVERRIDE; |
| 74 virtual content::WebContents* OpenURLFromTab( | 74 virtual content::WebContents* OpenURLFromTab( |
| 75 content::WebContents* source, | 75 content::WebContents* source, |
| 76 const content::OpenURLParams& params) OVERRIDE; | 76 const content::OpenURLParams& params) OVERRIDE; |
| 77 virtual void AddNewContents(content::WebContents* source, | 77 virtual bool AddNewContents(content::WebContents* source, |
| 78 content::WebContents* new_contents, | 78 content::WebContents* new_contents, |
| 79 WindowOpenDisposition disposition, | 79 WindowOpenDisposition disposition, |
| 80 const gfx::Rect& initial_pos, | 80 const gfx::Rect& initial_pos, |
| 81 bool user_gesture) OVERRIDE; | 81 bool user_gesture) OVERRIDE; |
| 82 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | 82 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 WebDialogWindowController* controller_; // weak | 85 WebDialogWindowController* controller_; // weak |
| 86 WebDialogDelegate* delegate_; // weak, owned by controller_ | 86 WebDialogDelegate* delegate_; // weak, owned by controller_ |
| 87 | 87 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 content::WebContents* source, | 222 content::WebContents* source, |
| 223 const content::OpenURLParams& params) { | 223 const content::OpenURLParams& params) { |
| 224 content::WebContents* new_contents = NULL; | 224 content::WebContents* new_contents = NULL; |
| 225 if (delegate_ && | 225 if (delegate_ && |
| 226 delegate_->HandleOpenURLFromTab(source, params, &new_contents)) { | 226 delegate_->HandleOpenURLFromTab(source, params, &new_contents)) { |
| 227 return new_contents; | 227 return new_contents; |
| 228 } | 228 } |
| 229 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params); | 229 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void WebDialogWindowDelegateBridge::AddNewContents( | 232 bool WebDialogWindowDelegateBridge::AddNewContents( |
| 233 content::WebContents* source, | 233 content::WebContents* source, |
| 234 content::WebContents* new_contents, | 234 content::WebContents* new_contents, |
| 235 WindowOpenDisposition disposition, | 235 WindowOpenDisposition disposition, |
| 236 const gfx::Rect& initial_pos, | 236 const gfx::Rect& initial_pos, |
| 237 bool user_gesture) { | 237 bool user_gesture) { |
| 238 if (delegate_ && delegate_->HandleAddNewContents( | 238 if (delegate_ && delegate_->HandleAddNewContents( |
| 239 source, new_contents, disposition, initial_pos, user_gesture)) { | 239 source, new_contents, disposition, initial_pos, user_gesture)) { |
| 240 return; | 240 return true; |
| 241 } | 241 } |
| 242 WebDialogWebContentsDelegate::AddNewContents( | 242 return WebDialogWebContentsDelegate::AddNewContents( |
| 243 source, new_contents, disposition, initial_pos, user_gesture); | 243 source, new_contents, disposition, initial_pos, user_gesture); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void WebDialogWindowDelegateBridge::LoadingStateChanged( | 246 void WebDialogWindowDelegateBridge::LoadingStateChanged( |
| 247 content::WebContents* source) { | 247 content::WebContents* source) { |
| 248 if (delegate_) | 248 if (delegate_) |
| 249 delegate_->OnLoadingStateChanged(source); | 249 delegate_->OnLoadingStateChanged(source); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, | 252 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 368 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 369 // to do the above doesn't work. | 369 // to do the above doesn't work. |
| 370 } | 370 } |
| 371 | 371 |
| 372 - (void)windowWillClose:(NSNotification*)notification { | 372 - (void)windowWillClose:(NSNotification*)notification { |
| 373 delegate_->WindowControllerClosed(); | 373 delegate_->WindowControllerClosed(); |
| 374 [self autorelease]; | 374 [self autorelease]; |
| 375 } | 375 } |
| 376 | 376 |
| 377 @end | 377 @end |
| OLD | NEW |