Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: chrome/browser/ui/cocoa/web_dialog_window_controller.mm

Issue 10868116: Pass result of blockage across content API when new tab blocked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void 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,
82 bool* was_blocked) OVERRIDE;
82 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; 83 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
83 84
84 private: 85 private:
85 WebDialogWindowController* controller_; // weak 86 WebDialogWindowController* controller_; // weak
86 WebDialogDelegate* delegate_; // weak, owned by controller_ 87 WebDialogDelegate* delegate_; // weak, owned by controller_
87 88
88 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards 89 // Calls delegate_'s OnDialogClosed() exactly once, nulling it out afterwards
89 // so that no other WebDialogDelegate calls are sent to it. Returns whether or 90 // so that no other WebDialogDelegate calls are sent to it. Returns whether or
90 // not the OnDialogClosed() was actually called on the delegate. 91 // not the OnDialogClosed() was actually called on the delegate.
91 bool DelegateOnDialogClosed(const std::string& json_retval); 92 bool DelegateOnDialogClosed(const std::string& json_retval);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return new_contents; 228 return new_contents;
228 } 229 }
229 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params); 230 return WebDialogWebContentsDelegate::OpenURLFromTab(source, params);
230 } 231 }
231 232
232 void WebDialogWindowDelegateBridge::AddNewContents( 233 void WebDialogWindowDelegateBridge::AddNewContents(
233 content::WebContents* source, 234 content::WebContents* source,
234 content::WebContents* new_contents, 235 content::WebContents* new_contents,
235 WindowOpenDisposition disposition, 236 WindowOpenDisposition disposition,
236 const gfx::Rect& initial_pos, 237 const gfx::Rect& initial_pos,
237 bool user_gesture) { 238 bool user_gesture,
239 bool* was_blocked) {
238 if (delegate_ && delegate_->HandleAddNewContents( 240 if (delegate_ && delegate_->HandleAddNewContents(
239 source, new_contents, disposition, initial_pos, user_gesture)) { 241 source, new_contents, disposition, initial_pos, user_gesture)) {
240 return; 242 return;
241 } 243 }
242 WebDialogWebContentsDelegate::AddNewContents( 244 WebDialogWebContentsDelegate::AddNewContents(
243 source, new_contents, disposition, initial_pos, user_gesture); 245 source, new_contents, disposition, initial_pos, user_gesture,
246 was_blocked);
244 } 247 }
245 248
246 void WebDialogWindowDelegateBridge::LoadingStateChanged( 249 void WebDialogWindowDelegateBridge::LoadingStateChanged(
247 content::WebContents* source) { 250 content::WebContents* source) {
248 if (delegate_) 251 if (delegate_)
249 delegate_->OnLoadingStateChanged(source); 252 delegate_->OnLoadingStateChanged(source);
250 } 253 }
251 254
252 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, 255 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source,
253 const gfx::Rect& pos) { 256 const gfx::Rect& pos) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender 371 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender
369 // to do the above doesn't work. 372 // to do the above doesn't work.
370 } 373 }
371 374
372 - (void)windowWillClose:(NSNotification*)notification { 375 - (void)windowWillClose:(NSNotification*)notification {
373 delegate_->WindowControllerClosed(); 376 delegate_->WindowControllerClosed();
374 [self autorelease]; 377 [self autorelease];
375 } 378 }
376 379
377 @end 380 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698