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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 virtual void CloseContents(WebContents* source) OVERRIDE; | 66 virtual void CloseContents(WebContents* source) OVERRIDE; |
67 virtual content::WebContents* OpenURLFromTab( | 67 virtual content::WebContents* OpenURLFromTab( |
68 content::WebContents* source, | 68 content::WebContents* source, |
69 const content::OpenURLParams& params) OVERRIDE; | 69 const content::OpenURLParams& params) OVERRIDE; |
70 virtual void AddNewContents(content::WebContents* source, | 70 virtual void AddNewContents(content::WebContents* source, |
71 content::WebContents* new_contents, | 71 content::WebContents* new_contents, |
72 WindowOpenDisposition disposition, | 72 WindowOpenDisposition disposition, |
73 const gfx::Rect& initial_pos, | 73 const gfx::Rect& initial_pos, |
74 bool user_gesture, | 74 bool user_gesture, |
75 bool* was_blocked) OVERRIDE; | 75 bool* was_blocked) OVERRIDE; |
76 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | 76 virtual void LoadingStateChanged(content::WebContents* source, |
| 77 bool to_different_document) OVERRIDE; |
77 | 78 |
78 private: | 79 private: |
79 WebDialogWindowController* controller_; // weak | 80 WebDialogWindowController* controller_; // weak |
80 WebDialogDelegate* delegate_; // weak, owned by controller_ | 81 WebDialogDelegate* delegate_; // weak, owned by controller_ |
81 | 82 |
82 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards | 83 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards |
83 // so that no other WebDialogDelegate calls are sent to it. Returns whether or | 84 // so that no other WebDialogDelegate calls are sent to it. Returns whether or |
84 // not the OnDialogClosed() was actually called on the delegate. | 85 // not the OnDialogClosed() was actually called on the delegate. |
85 bool DelegateOnDialogClosed(const std::string& json_retval); | 86 bool DelegateOnDialogClosed(const std::string& json_retval); |
86 | 87 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (delegate_ && delegate_->HandleAddNewContents( | 234 if (delegate_ && delegate_->HandleAddNewContents( |
234 source, new_contents, disposition, initial_pos, user_gesture)) { | 235 source, new_contents, disposition, initial_pos, user_gesture)) { |
235 return; | 236 return; |
236 } | 237 } |
237 WebDialogWebContentsDelegate::AddNewContents( | 238 WebDialogWebContentsDelegate::AddNewContents( |
238 source, new_contents, disposition, initial_pos, user_gesture, | 239 source, new_contents, disposition, initial_pos, user_gesture, |
239 was_blocked); | 240 was_blocked); |
240 } | 241 } |
241 | 242 |
242 void WebDialogWindowDelegateBridge::LoadingStateChanged( | 243 void WebDialogWindowDelegateBridge::LoadingStateChanged( |
243 content::WebContents* source) { | 244 content::WebContents* source, bool to_different_document) { |
244 if (delegate_) | 245 if (delegate_) |
245 delegate_->OnLoadingStateChanged(source); | 246 delegate_->OnLoadingStateChanged(source); |
246 } | 247 } |
247 | 248 |
248 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, | 249 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, |
249 const gfx::Rect& pos) { | 250 const gfx::Rect& pos) { |
250 // TODO(akalin): Actually set the window bounds. | 251 // TODO(akalin): Actually set the window bounds. |
251 } | 252 } |
252 | 253 |
253 // A simplified version of BrowserWindowCocoa::HandleKeyboardEvent(). | 254 // A simplified version of BrowserWindowCocoa::HandleKeyboardEvent(). |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 362 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
362 // to do the above doesn't work. | 363 // to do the above doesn't work. |
363 } | 364 } |
364 | 365 |
365 - (void)windowWillClose:(NSNotification*)notification { | 366 - (void)windowWillClose:(NSNotification*)notification { |
366 delegate_->WindowControllerClosed(); | 367 delegate_->WindowControllerClosed(); |
367 [self autorelease]; | 368 [self autorelease]; |
368 } | 369 } |
369 | 370 |
370 @end | 371 @end |
OLD | NEW |