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/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
15 #include "base/mac/scoped_nsautorelease_pool.h" | 15 #include "base/mac/scoped_nsautorelease_pool.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
22 #include "chrome/browser/devtools/devtools_window.h" | |
23 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
24 #include "chrome/browser/favicon/favicon_tab_helper.h" | 23 #include "chrome/browser/favicon/favicon_tab_helper.h" |
25 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/themes/theme_service.h" | 26 #include "chrome/browser/themes/theme_service.h" |
28 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_navigator.h" | 28 #include "chrome/browser/ui/browser_navigator.h" |
30 #include "chrome/browser/ui/browser_tabstrip.h" | 29 #include "chrome/browser/ui/browser_tabstrip.h" |
31 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 30 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
32 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" | 31 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 forButtonState:image_button_cell::kHoverStateBackground]; | 2214 forButtonState:image_button_cell::kHoverStateBackground]; |
2216 } | 2215 } |
2217 } | 2216 } |
2218 | 2217 |
2219 @end | 2218 @end |
2220 | 2219 |
2221 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2220 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2222 // View hierarchy of the contents view: | 2221 // View hierarchy of the contents view: |
2223 // NSView -- switchView, same for all tabs | 2222 // NSView -- switchView, same for all tabs |
2224 // +- NSView -- TabContentsController's view | 2223 // +- NSView -- TabContentsController's view |
2225 // +- TabContentsViewCocoa | 2224 // +- WebContentsViewCocoa |
2226 // | 2225 // |
2227 // Changing it? Do not forget to modify | 2226 // Changing it? Do not forget to modify |
2228 // -[TabStripController swapInTabAtIndex:] too. | 2227 // -[TabStripController swapInTabAtIndex:] too. |
2229 return [web_contents->GetNativeView() superview]; | 2228 return [web_contents->GetNativeView() superview]; |
2230 } | 2229 } |
| 2230 |
| 2231 NSRect GetSheetParentBoundsForParentView(NSView* view) { |
| 2232 // If the devtools view is open, it shrinks the size of the WebContents, so go |
| 2233 // up the hierarchy to the devtools container view to avoid that. Note that |
| 2234 // the devtools view is always in the hierarchy even if it is not open or it |
| 2235 // is detached. |
| 2236 NSView* devtools_view = [[[view superview] superview] superview]; |
| 2237 return [devtools_view convertRect:[devtools_view bounds] toView:nil]; |
| 2238 } |
OLD | NEW |