OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <numeric> | 8 #include <numeric> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" | 77 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" |
78 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 78 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
79 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 79 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
80 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
81 #include "chrome/common/extensions/command.h" | 81 #include "chrome/common/extensions/command.h" |
82 #include "chrome/common/url_constants.h" | 82 #include "chrome/common/url_constants.h" |
83 #include "components/bookmarks/browser/bookmark_model.h" | 83 #include "components/bookmarks/browser/bookmark_model.h" |
84 #include "components/signin/core/common/profile_management_switches.h" | 84 #include "components/signin/core/common/profile_management_switches.h" |
85 #include "components/translate/core/browser/translate_manager.h" | 85 #include "components/translate/core/browser/translate_manager.h" |
86 #include "components/translate/core/browser/translate_ui_delegate.h" | 86 #include "components/translate/core/browser/translate_ui_delegate.h" |
87 #include "components/web_modal/popup_manager.h" | |
88 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 87 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
89 #include "content/public/browser/render_view_host.h" | 88 #include "content/public/browser/render_view_host.h" |
90 #include "content/public/browser/render_widget_host_view.h" | 89 #include "content/public/browser/render_widget_host_view.h" |
91 #include "content/public/browser/web_contents.h" | 90 #include "content/public/browser/web_contents.h" |
92 #include "grit/chromium_strings.h" | 91 #include "grit/chromium_strings.h" |
93 #include "grit/generated_resources.h" | 92 #include "grit/generated_resources.h" |
94 #include "grit/locale_settings.h" | 93 #include "grit/locale_settings.h" |
95 #import "ui/base/cocoa/cocoa_base_utils.h" | 94 #import "ui/base/cocoa/cocoa_base_utils.h" |
96 #include "ui/base/l10n/l10n_util.h" | 95 #include "ui/base/l10n/l10n_util.h" |
97 #include "ui/base/l10n/l10n_util_mac.h" | 96 #include "ui/base/l10n/l10n_util_mac.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // any shrink whether we're both zoomed and have previously grown -- if so, we | 171 // any shrink whether we're both zoomed and have previously grown -- if so, we |
173 // set a flag, and constrain any resize by the allowed amounts. On further | 172 // set a flag, and constrain any resize by the allowed amounts. On further |
174 // shrinks, we check the flag (since the size/position of the window will no | 173 // shrinks, we check the flag (since the size/position of the window will no |
175 // longer indicate that the window is shrinking from an apparent zoomed state) | 174 // longer indicate that the window is shrinking from an apparent zoomed state) |
176 // and if it's set we continue to constrain the resize. | 175 // and if it's set we continue to constrain the resize. |
177 | 176 |
178 using content::OpenURLParams; | 177 using content::OpenURLParams; |
179 using content::Referrer; | 178 using content::Referrer; |
180 using content::RenderWidgetHostView; | 179 using content::RenderWidgetHostView; |
181 using content::WebContents; | 180 using content::WebContents; |
| 181 using web_modal::WebContentsModalDialogManager; |
182 | 182 |
183 @interface NSWindow (NSPrivateApis) | 183 @interface NSWindow (NSPrivateApis) |
184 // Note: These functions are private, use -[NSObject respondsToSelector:] | 184 // Note: These functions are private, use -[NSObject respondsToSelector:] |
185 // before calling them. | 185 // before calling them. |
186 | 186 |
187 - (void)setBottomCornerRounded:(BOOL)rounded; | 187 - (void)setBottomCornerRounded:(BOOL)rounded; |
188 | 188 |
189 - (NSRect)_growBoxRect; | 189 - (NSRect)_growBoxRect; |
190 | 190 |
191 @end | 191 @end |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 } | 1598 } |
1599 | 1599 |
1600 - (BOOL)isTabDraggable:(NSView*)tabView { | 1600 - (BOOL)isTabDraggable:(NSView*)tabView { |
1601 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move | 1601 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move |
1602 // tabsheets between windows. Until then, we have to prevent having to move a | 1602 // tabsheets between windows. Until then, we have to prevent having to move a |
1603 // tabsheet between windows, e.g. no tearing off of tabs. | 1603 // tabsheet between windows, e.g. no tearing off of tabs. |
1604 int index = [tabStripController_ modelIndexForTabView:tabView]; | 1604 int index = [tabStripController_ modelIndexForTabView:tabView]; |
1605 WebContents* contents = browser_->tab_strip_model()->GetWebContentsAt(index); | 1605 WebContents* contents = browser_->tab_strip_model()->GetWebContentsAt(index); |
1606 if (!contents) | 1606 if (!contents) |
1607 return NO; | 1607 return NO; |
1608 | 1608 return !WebContentsModalDialogManager::FromWebContents(contents)-> |
1609 return !web_modal::PopupManager::FromWebContents(contents)-> | 1609 IsDialogActive(); |
1610 IsWebModalDialogActive(contents); | |
1611 } | 1610 } |
1612 | 1611 |
1613 // TabStripControllerDelegate protocol. | 1612 // TabStripControllerDelegate protocol. |
1614 - (void)onActivateTabWithContents:(WebContents*)contents { | 1613 - (void)onActivateTabWithContents:(WebContents*)contents { |
1615 // Update various elements that are interested in knowing the current | 1614 // Update various elements that are interested in knowing the current |
1616 // WebContents. | 1615 // WebContents. |
1617 | 1616 |
1618 // Update all the UI bits. | 1617 // Update all the UI bits. |
1619 windowShim_->UpdateTitleBar(); | 1618 windowShim_->UpdateTitleBar(); |
1620 | 1619 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 | 2291 |
2293 - (BOOL)supportsBookmarkBar { | 2292 - (BOOL)supportsBookmarkBar { |
2294 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2293 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2295 } | 2294 } |
2296 | 2295 |
2297 - (BOOL)isTabbedWindow { | 2296 - (BOOL)isTabbedWindow { |
2298 return browser_->is_type_tabbed(); | 2297 return browser_->is_type_tabbed(); |
2299 } | 2298 } |
2300 | 2299 |
2301 @end // @implementation BrowserWindowController(WindowType) | 2300 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |