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

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

Issue 10837112: Add WebContents* to some more WebContentsDelegate methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 4 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/gtk/web_dialog_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/property_bag.h" 9 #include "base/property_bag.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 54 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
55 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE; 55 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE;
56 virtual std::string GetDialogArgs() const OVERRIDE; 56 virtual std::string GetDialogArgs() const OVERRIDE;
57 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 57 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
58 virtual void OnCloseContents(WebContents* source, 58 virtual void OnCloseContents(WebContents* source,
59 bool* out_close_dialog) OVERRIDE; 59 bool* out_close_dialog) OVERRIDE;
60 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } 60 virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; }
61 61
62 // WebDialogWebContentsDelegate declarations. 62 // WebDialogWebContentsDelegate declarations.
63 virtual void MoveContents(WebContents* source, const gfx::Rect& pos); 63 virtual void MoveContents(WebContents* source, const gfx::Rect& pos);
64 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); 64 virtual void HandleKeyboardEvent(content::WebContents* source,
65 const NativeWebKeyboardEvent& event);
65 virtual void CloseContents(WebContents* source) OVERRIDE; 66 virtual void CloseContents(WebContents* source) OVERRIDE;
66 virtual content::WebContents* OpenURLFromTab( 67 virtual content::WebContents* OpenURLFromTab(
67 content::WebContents* source, 68 content::WebContents* source,
68 const content::OpenURLParams& params) OVERRIDE; 69 const content::OpenURLParams& params) OVERRIDE;
69 virtual void AddNewContents(content::WebContents* source, 70 virtual void AddNewContents(content::WebContents* source,
70 content::WebContents* new_contents, 71 content::WebContents* new_contents,
71 WindowOpenDisposition disposition, 72 WindowOpenDisposition disposition,
72 const gfx::Rect& initial_pos, 73 const gfx::Rect& initial_pos,
73 bool user_gesture) OVERRIDE; 74 bool user_gesture) OVERRIDE;
74 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; 75 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 244
244 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source, 245 void WebDialogWindowDelegateBridge::MoveContents(WebContents* source,
245 const gfx::Rect& pos) { 246 const gfx::Rect& pos) {
246 // TODO(akalin): Actually set the window bounds. 247 // TODO(akalin): Actually set the window bounds.
247 } 248 }
248 249
249 // A simplified version of BrowserWindowCocoa::HandleKeyboardEvent(). 250 // A simplified version of BrowserWindowCocoa::HandleKeyboardEvent().
250 // We don't handle global keyboard shortcuts here, but that's fine since 251 // We don't handle global keyboard shortcuts here, but that's fine since
251 // they're all browser-specific. (This may change in the future.) 252 // they're all browser-specific. (This may change in the future.)
252 void WebDialogWindowDelegateBridge::HandleKeyboardEvent( 253 void WebDialogWindowDelegateBridge::HandleKeyboardEvent(
254 content::WebContents* source,
253 const NativeWebKeyboardEvent& event) { 255 const NativeWebKeyboardEvent& event) {
254 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) 256 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char)
255 return; 257 return;
256 258
257 // Close ourselves if the user hits Esc or Command-. . The normal 259 // Close ourselves if the user hits Esc or Command-. . The normal
258 // way to do this is to implement (void)cancel:(int)sender, but 260 // way to do this is to implement (void)cancel:(int)sender, but
259 // since we handle keyboard events ourselves we can't do that. 261 // since we handle keyboard events ourselves we can't do that.
260 // 262 //
261 // According to experiments, hitting Esc works regardless of the 263 // According to experiments, hitting Esc works regardless of the
262 // presence of other modifiers (as long as it's not an app-level 264 // presence of other modifiers (as long as it's not an app-level
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender 360 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender
359 // to do the above doesn't work. 361 // to do the above doesn't work.
360 } 362 }
361 363
362 - (void)windowWillClose:(NSNotification*)notification { 364 - (void)windowWillClose:(NSNotification*)notification {
363 delegate_->WindowControllerClosed(); 365 delegate_->WindowControllerClosed();
364 [self autorelease]; 366 [self autorelease];
365 } 367 }
366 368
367 @end 369 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/gtk/web_dialog_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698