| 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/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "chrome/browser/ui/browser_dialogs.h" | 10 #import "chrome/browser/ui/browser_dialogs.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void MoveContents(WebContents* source, const gfx::Rect& pos) override; | 60 void MoveContents(WebContents* source, const gfx::Rect& pos) override; |
| 61 void HandleKeyboardEvent(content::WebContents* source, | 61 void HandleKeyboardEvent(content::WebContents* source, |
| 62 const NativeWebKeyboardEvent& event) override; | 62 const NativeWebKeyboardEvent& event) override; |
| 63 void CloseContents(WebContents* source) override; | 63 void CloseContents(WebContents* source) override; |
| 64 content::WebContents* OpenURLFromTab( | 64 content::WebContents* OpenURLFromTab( |
| 65 content::WebContents* source, | 65 content::WebContents* source, |
| 66 const content::OpenURLParams& params) override; | 66 const content::OpenURLParams& params) override; |
| 67 void AddNewContents(content::WebContents* source, | 67 void AddNewContents(content::WebContents* source, |
| 68 content::WebContents* new_contents, | 68 content::WebContents* new_contents, |
| 69 WindowOpenDisposition disposition, | 69 WindowOpenDisposition disposition, |
| 70 const gfx::Rect& initial_pos, | 70 const gfx::Rect& initial_rect, |
| 71 bool user_gesture, | 71 bool user_gesture, |
| 72 bool* was_blocked) override; | 72 bool* was_blocked) override; |
| 73 void LoadingStateChanged(content::WebContents* source, | 73 void LoadingStateChanged(content::WebContents* source, |
| 74 bool to_different_document) override; | 74 bool to_different_document) override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 WebDialogWindowController* controller_; // weak | 77 WebDialogWindowController* controller_; // weak |
| 78 WebDialogDelegate* delegate_; // weak, owned by controller_ | 78 WebDialogDelegate* delegate_; // weak, owned by controller_ |
| 79 | 79 |
| 80 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards | 80 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 delegate_->HandleOpenURLFromTab(source, params, &new_contents)) { | 218 delegate_->HandleOpenURLFromTab(source, params, &new_contents)) { |
| 219 return new_contents; | 219 return new_contents; |
| 220 } | 220 } |
| 221 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params); | 221 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void WebDialogWindowDelegateBridge::AddNewContents( | 224 void WebDialogWindowDelegateBridge::AddNewContents( |
| 225 content::WebContents* source, | 225 content::WebContents* source, |
| 226 content::WebContents* new_contents, | 226 content::WebContents* new_contents, |
| 227 WindowOpenDisposition disposition, | 227 WindowOpenDisposition disposition, |
| 228 const gfx::Rect& initial_pos, | 228 const gfx::Rect& initial_rect, |
| 229 bool user_gesture, | 229 bool user_gesture, |
| 230 bool* was_blocked) { | 230 bool* was_blocked) { |
| 231 if (delegate_ && delegate_->HandleAddNewContents( | 231 if (delegate_ && delegate_->HandleAddNewContents( |
| 232 source, new_contents, disposition, initial_pos, user_gesture)) { | 232 source, new_contents, disposition, initial_rect, user_gesture)) { |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 WebDialogWebContentsDelegate::AddNewContents( | 235 WebDialogWebContentsDelegate::AddNewContents( |
| 236 source, new_contents, disposition, initial_pos, user_gesture, | 236 source, new_contents, disposition, initial_rect, user_gesture, |
| 237 was_blocked); | 237 was_blocked); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void WebDialogWindowDelegateBridge::LoadingStateChanged( | 240 void WebDialogWindowDelegateBridge::LoadingStateChanged( |
| 241 content::WebContents* source, bool to_different_document) { | 241 content::WebContents* source, bool to_different_document) { |
| 242 if (delegate_) | 242 if (delegate_) |
| 243 delegate_->OnLoadingStateChanged(source); | 243 delegate_->OnLoadingStateChanged(source); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, | 246 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 359 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 360 // to do the above doesn't work. | 360 // to do the above doesn't work. |
| 361 } | 361 } |
| 362 | 362 |
| 363 - (void)windowWillClose:(NSNotification*)notification { | 363 - (void)windowWillClose:(NSNotification*)notification { |
| 364 delegate_->WindowControllerClosed(); | 364 delegate_->WindowControllerClosed(); |
| 365 [self autorelease]; | 365 [self autorelease]; |
| 366 } | 366 } |
| 367 | 367 |
| 368 @end | 368 @end |
| OLD | NEW |