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

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

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 3 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
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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" 56 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
57 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" 57 #import "chrome/browser/ui/cocoa/status_bubble_mac.h"
58 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" 58 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h"
59 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 59 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
60 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 60 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
61 #import "chrome/browser/ui/cocoa/tabpose_window.h" 61 #import "chrome/browser/ui/cocoa/tabpose_window.h"
62 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 62 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
64 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 64 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
65 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 65 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
66 #include "chrome/browser/ui/constrained_window_tab_helper.h"
66 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" 67 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
67 #include "chrome/browser/ui/omnibox/location_bar.h" 68 #include "chrome/browser/ui/omnibox/location_bar.h"
68 #include "chrome/browser/ui/tab_contents/tab_contents.h" 69 #include "chrome/browser/ui/tab_contents/tab_contents.h"
69 #include "chrome/browser/ui/tabs/dock_info.h" 70 #include "chrome/browser/ui/tabs/dock_info.h"
70 #include "chrome/browser/ui/tabs/tab_strip_model.h" 71 #include "chrome/browser/ui/tabs/tab_strip_model.h"
71 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 72 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
72 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 73 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
73 #include "chrome/browser/ui/window_sizer/window_sizer.h" 74 #include "chrome/browser/ui/window_sizer/window_sizer.h"
74 #include "chrome/common/chrome_switches.h" 75 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/url_constants.h" 76 #include "chrome/common/url_constants.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 statusBubble_ = NULL; 522 statusBubble_ = NULL;
522 // We can't actually use |-autorelease| here because there's an embedded 523 // We can't actually use |-autorelease| here because there's an embedded
523 // run loop in the |-performClose:| which contains its own autorelease pool. 524 // run loop in the |-performClose:| which contains its own autorelease pool.
524 // Instead call it after a zero-length delay, which gets us back to the main 525 // Instead call it after a zero-length delay, which gets us back to the main
525 // event loop. 526 // event loop.
526 [self performSelector:@selector(autorelease) 527 [self performSelector:@selector(autorelease)
527 withObject:nil 528 withObject:nil
528 afterDelay:0]; 529 afterDelay:0];
529 } 530 }
530 531
531 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window {
532 [tabStripController_ attachConstrainedWindow:window];
533 }
534
535 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
536 [tabStripController_ removeConstrainedWindow:window];
537 }
538
539 - (BOOL)canAttachConstrainedWindow {
540 return ![previewableContentsController_ isShowingPreview];
541 }
542
543 - (void)updateDevToolsForContents:(WebContents*)contents { 532 - (void)updateDevToolsForContents:(WebContents*)contents {
544 [devToolsController_ updateDevToolsForWebContents:contents 533 [devToolsController_ updateDevToolsForWebContents:contents
545 withProfile:browser_->profile()]; 534 withProfile:browser_->profile()];
546 } 535 }
547 536
548 - (void)setDevToolsDockToRight:(bool)dock_to_right { 537 - (void)setDevToolsDockToRight:(bool)dock_to_right {
549 [devToolsController_ setDockToRight:dock_to_right 538 [devToolsController_ setDockToRight:dock_to_right
550 withProfile:browser_->profile()]; 539 withProfile:browser_->profile()];
551 } 540 }
552 541
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 - (NSRect)regularWindowFrame { 1514 - (NSRect)regularWindowFrame {
1526 return [self isFullscreen] ? savedRegularWindowFrame_ : 1515 return [self isFullscreen] ? savedRegularWindowFrame_ :
1527 [[self window] frame]; 1516 [[self window] frame];
1528 } 1517 }
1529 1518
1530 // (Override of |TabWindowController| method.) 1519 // (Override of |TabWindowController| method.)
1531 - (BOOL)hasTabStrip { 1520 - (BOOL)hasTabStrip {
1532 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; 1521 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP];
1533 } 1522 }
1534 1523
1524 - (BOOL)isTabDraggable:(NSView*)tabView {
1525 // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets
1526 // between windows. Until then, we have to prevent having to move a tabsheet
1527 // between windows, e.g. no tearing off of tabs.
1528 int index = [tabStripController_ modelIndexForTabView:tabView];
1529 TabContents* contents = chrome::GetTabContentsAt(browser_.get(), index);
1530 if (!contents)
1531 return NO;
1532 return !contents->constrained_window_tab_helper()->constrained_window_count();
1533 }
1534
1535 // TabStripControllerDelegate protocol. 1535 // TabStripControllerDelegate protocol.
1536 - (void)onActivateTabWithContents:(WebContents*)contents { 1536 - (void)onActivateTabWithContents:(WebContents*)contents {
1537 // Update various elements that are interested in knowing the current 1537 // Update various elements that are interested in knowing the current
1538 // WebContents. 1538 // WebContents.
1539 1539
1540 // Update all the UI bits. 1540 // Update all the UI bits.
1541 windowShim_->UpdateTitleBar(); 1541 windowShim_->UpdateTitleBar();
1542 1542
1543 [devToolsController_ updateDevToolsForWebContents:contents 1543 [devToolsController_ updateDevToolsForWebContents:contents
1544 withProfile:browser_->profile()]; 1544 withProfile:browser_->profile()];
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 [previewableContentsController_ hidePreview]; 1933 [previewableContentsController_ hidePreview];
1934 [self updateBookmarkBarVisibilityWithAnimation:NO]; 1934 [self updateBookmarkBarVisibilityWithAnimation:NO];
1935 } 1935 }
1936 1936
1937 - (void)commitInstant { 1937 - (void)commitInstant {
1938 InstantController* instant = browser_->instant_controller()->instant(); 1938 InstantController* instant = browser_->instant_controller()->instant();
1939 if (instant && instant->IsCurrent()) 1939 if (instant && instant->IsCurrent())
1940 instant->CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); 1940 instant->CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST);
1941 } 1941 }
1942 1942
1943 - (BOOL)isShowingInstant {
1944 return previewableContentsController_ &&
1945 [previewableContentsController_ isShowingPreview];
1946 }
1943 1947
1944 - (NSRect)instantFrame { 1948 - (NSRect)instantFrame {
1945 // The view's bounds are in its own coordinate system. Convert that to the 1949 // The view's bounds are in its own coordinate system. Convert that to the
1946 // window base coordinate system, then translate it into the screen's 1950 // window base coordinate system, then translate it into the screen's
1947 // coordinate system. 1951 // coordinate system.
1948 NSView* view = [previewableContentsController_ view]; 1952 NSView* view = [previewableContentsController_ view];
1949 if (!view) 1953 if (!view)
1950 return NSZeroRect; 1954 return NSZeroRect;
1951 1955
1952 NSRect frame = [view convertRect:[view bounds] toView:nil]; 1956 NSRect frame = [view convertRect:[view bounds] toView:nil];
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 2221
2218 - (BOOL)supportsBookmarkBar { 2222 - (BOOL)supportsBookmarkBar {
2219 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2223 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2220 } 2224 }
2221 2225
2222 - (BOOL)isTabbedWindow { 2226 - (BOOL)isTabbedWindow {
2223 return browser_->is_type_tabbed(); 2227 return browser_->is_type_tabbed();
2224 } 2228 }
2225 2229
2226 @end // @implementation BrowserWindowController(WindowType) 2230 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698