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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm

Issue 1053463002: MacViews: Use native certificate viewer in MacViews browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@translate
Patch Set: Fix tests Created 5 years, 8 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
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/constrained_window/constrained_window_sheet_con troller.h" 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_in fo.h" 11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_in fo.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
13 12
14 namespace { 13 namespace {
15 14
16 // Maps parent windows to sheet controllers. 15 // Maps parent windows to sheet controllers.
17 NSMutableDictionary* g_sheetControllers; 16 NSMutableDictionary* g_sheetControllers;
18 17
19 // Get a value for the given window that can be used as a key in a dictionary. 18 // Get a value for the given window that can be used as a key in a dictionary.
20 NSValue* GetKeyForParentWindow(NSWindow* parent_window) { 19 NSValue* GetKeyForParentWindow(NSWindow* parent_window) {
21 return [NSValue valueWithNonretainedObject:parent_window]; 20 return [NSValue valueWithNonretainedObject:parent_window];
22 } 21 }
23 22
23 // Returns the bounds to use when showing a sheet for a given parent view. This
24 // returns a rect in window coordinates.
25 NSRect GetSheetParentBoundsForParentView(NSView* view) {
26 // If the devtools view is open, it shrinks the size of the WebContents, so go
27 // up the hierarchy to the devtools container view to avoid that. Note that
28 // the devtools view is always in the hierarchy even if it is not open or it
29 // is detached.
30 NSView* devtools_view = [[[view superview] superview] superview];
31 if (devtools_view) {
32 return [devtools_view convertRect:[devtools_view bounds] toView:nil];
33 } else {
tapted 2015/04/02 04:35:22 hm - I see you're just moving this, but this fails
Andre 2015/04/02 17:17:31 Done.
34 return [view convertRect:[view bounds] toView:nil];
35 }
36 }
37
24 } // namespace 38 } // namespace
25 39
26 // An invisible overlay window placed on top of the sheet's parent view. 40 // An invisible overlay window placed on top of the sheet's parent view.
27 // This window blocks interaction with the underlying view. 41 // This window blocks interaction with the underlying view.
28 @interface CWSheetOverlayWindow : NSWindow { 42 @interface CWSheetOverlayWindow : NSWindow {
29 base::scoped_nsobject<ConstrainedWindowSheetController> controller_; 43 base::scoped_nsobject<ConstrainedWindowSheetController> controller_;
30 } 44 }
31 @end 45 @end
32 46
33 @interface ConstrainedWindowSheetController () 47 @interface ConstrainedWindowSheetController ()
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 name:NSWindowDidResizeNotification 307 name:NSWindowDidResizeNotification
294 object:parentWindow_]; 308 object:parentWindow_];
295 309
296 [parentWindow_ removeChildWindow:[info overlayWindow]]; 310 [parentWindow_ removeChildWindow:[info overlayWindow]];
297 [[info sheet] closeSheetWithAnimation:withAnimation]; 311 [[info sheet] closeSheetWithAnimation:withAnimation];
298 [[info overlayWindow] close]; 312 [[info overlayWindow] close];
299 [sheets_ removeObject:info]; 313 [sheets_ removeObject:info];
300 } 314 }
301 315
302 @end 316 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698