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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 57 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
58 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 58 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
59 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 59 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
60 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 60 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
61 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 61 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
62 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 62 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
65 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 65 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
66 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 66 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 67 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
67 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 68 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
68 #include "chrome/browser/ui/omnibox/location_bar.h" | 69 #include "chrome/browser/ui/omnibox/location_bar.h" |
69 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 70 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
70 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 71 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
71 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 72 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 73 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
72 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 74 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
73 #include "chrome/common/chrome_switches.h" | 75 #include "chrome/common/chrome_switches.h" |
74 #include "chrome/common/profile_management_switches.h" | 76 #include "chrome/common/profile_management_switches.h" |
75 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
76 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 78 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
77 #include "content/public/browser/render_view_host.h" | 79 #include "content/public/browser/render_view_host.h" |
78 #include "content/public/browser/render_widget_host_view.h" | 80 #include "content/public/browser/render_widget_host_view.h" |
79 #include "content/public/browser/web_contents.h" | 81 #include "content/public/browser/web_contents.h" |
80 #include "content/public/browser/web_contents_view.h" | 82 #include "content/public/browser/web_contents_view.h" |
81 #include "grit/chromium_strings.h" | 83 #include "grit/chromium_strings.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 NSRect frame = [[self window] frame]; | 414 NSRect frame = [[self window] frame]; |
413 frame.size.height += convertedSize.height; | 415 frame.size.height += convertedSize.height; |
414 frame.origin.y -= convertedSize.height; | 416 frame.origin.y -= convertedSize.height; |
415 [[self window] setFrame:frame display:NO]; | 417 [[self window] setFrame:frame display:NO]; |
416 } | 418 } |
417 } | 419 } |
418 | 420 |
419 // Create the bridge for the status bubble. | 421 // Create the bridge for the status bubble. |
420 statusBubble_ = new StatusBubbleMac([self window], self); | 422 statusBubble_ = new StatusBubbleMac([self window], self); |
421 | 423 |
| 424 // Create the permissions bubble. |
| 425 permissionBubbleCocoa_.reset(new PermissionBubbleCocoa([self window])); |
| 426 |
422 // Register for application hide/unhide notifications. | 427 // Register for application hide/unhide notifications. |
423 [[NSNotificationCenter defaultCenter] | 428 [[NSNotificationCenter defaultCenter] |
424 addObserver:self | 429 addObserver:self |
425 selector:@selector(applicationDidHide:) | 430 selector:@selector(applicationDidHide:) |
426 name:NSApplicationDidHideNotification | 431 name:NSApplicationDidHideNotification |
427 object:nil]; | 432 object:nil]; |
428 [[NSNotificationCenter defaultCenter] | 433 [[NSNotificationCenter defaultCenter] |
429 addObserver:self | 434 addObserver:self |
430 selector:@selector(applicationDidUnhide:) | 435 selector:@selector(applicationDidUnhide:) |
431 name:NSApplicationDidUnhideNotification | 436 name:NSApplicationDidUnhideNotification |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 windowShim_->UpdateTitleBar(); | 1624 windowShim_->UpdateTitleBar(); |
1620 | 1625 |
1621 // Update the bookmark bar. | 1626 // Update the bookmark bar. |
1622 // TODO(viettrungluu): perhaps update to not terminate running animations (if | 1627 // TODO(viettrungluu): perhaps update to not terminate running animations (if |
1623 // applicable)? | 1628 // applicable)? |
1624 windowShim_->BookmarkBarStateChanged( | 1629 windowShim_->BookmarkBarStateChanged( |
1625 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 1630 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
1626 | 1631 |
1627 [infoBarContainerController_ changeWebContents:contents]; | 1632 [infoBarContainerController_ changeWebContents:contents]; |
1628 | 1633 |
| 1634 // No need to remove previous bubble. It will close itself. |
| 1635 // TODO(leng): The PermissionBubbleManager for the previous contents should |
| 1636 // have SetView(NULL) called. Fix this when the previous contents are |
| 1637 // available here or move to BrowserWindowCocoa::OnActiveTabChanged(). |
| 1638 // crbug.com/340720 |
| 1639 PermissionBubbleManager::FromWebContents(contents)->SetView( |
| 1640 permissionBubbleCocoa_.get()); |
| 1641 |
1629 // Must do this after bookmark and infobar updates to avoid | 1642 // Must do this after bookmark and infobar updates to avoid |
1630 // unnecesary resize in contents. | 1643 // unnecesary resize in contents. |
1631 [devToolsController_ updateDevToolsForWebContents:contents | 1644 [devToolsController_ updateDevToolsForWebContents:contents |
1632 withProfile:browser_->profile()]; | 1645 withProfile:browser_->profile()]; |
1633 | 1646 |
1634 [self updateAllowOverlappingViews:[self inPresentationMode]]; | 1647 [self updateAllowOverlappingViews:[self inPresentationMode]]; |
1635 } | 1648 } |
1636 | 1649 |
1637 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1650 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
1638 withContents:(WebContents*)contents { | 1651 withContents:(WebContents*)contents { |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 | 2248 |
2236 - (BOOL)supportsBookmarkBar { | 2249 - (BOOL)supportsBookmarkBar { |
2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2250 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2238 } | 2251 } |
2239 | 2252 |
2240 - (BOOL)isTabbedWindow { | 2253 - (BOOL)isTabbedWindow { |
2241 return browser_->is_type_tabbed(); | 2254 return browser_->is_type_tabbed(); |
2242 } | 2255 } |
2243 | 2256 |
2244 @end // @implementation BrowserWindowController(WindowType) | 2257 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |