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> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "grit/ui_resources.h" | 64 #include "grit/ui_resources.h" |
65 #include "skia/ext/skia_utils_mac.h" | 65 #include "skia/ext/skia_utils_mac.h" |
66 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 66 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
67 #include "ui/base/cocoa/animation_utils.h" | 67 #include "ui/base/cocoa/animation_utils.h" |
68 #import "ui/base/cocoa/tracking_area.h" | 68 #import "ui/base/cocoa/tracking_area.h" |
69 #include "ui/base/l10n/l10n_util.h" | 69 #include "ui/base/l10n/l10n_util.h" |
70 #include "ui/base/models/list_selection_model.h" | 70 #include "ui/base/models/list_selection_model.h" |
71 #include "ui/base/resource/resource_bundle.h" | 71 #include "ui/base/resource/resource_bundle.h" |
72 #include "ui/base/theme_provider.h" | 72 #include "ui/base/theme_provider.h" |
73 #include "ui/gfx/image/image.h" | 73 #include "ui/gfx/image/image.h" |
| 74 #include "ui/gfx/mac/scoped_ns_disable_screen_updates.h" |
74 | 75 |
75 using base::UserMetricsAction; | 76 using base::UserMetricsAction; |
76 using content::OpenURLParams; | 77 using content::OpenURLParams; |
77 using content::Referrer; | 78 using content::Referrer; |
78 using content::WebContents; | 79 using content::WebContents; |
79 | 80 |
80 namespace { | 81 namespace { |
81 | 82 |
82 // A value to indicate tab layout should use the full available width of the | 83 // A value to indicate tab layout should use the full available width of the |
83 // view. | 84 // view. |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 607 } |
607 | 608 |
608 // Finds the TabContentsController associated with the given index into the tab | 609 // Finds the TabContentsController associated with the given index into the tab |
609 // model and swaps out the sole child of the contentArea to display its | 610 // model and swaps out the sole child of the contentArea to display its |
610 // contents. | 611 // contents. |
611 - (void)swapInTabAtIndex:(NSInteger)modelIndex { | 612 - (void)swapInTabAtIndex:(NSInteger)modelIndex { |
612 DCHECK(modelIndex >= 0 && modelIndex < tabStripModel_->count()); | 613 DCHECK(modelIndex >= 0 && modelIndex < tabStripModel_->count()); |
613 NSInteger index = [self indexFromModelIndex:modelIndex]; | 614 NSInteger index = [self indexFromModelIndex:modelIndex]; |
614 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index]; | 615 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index]; |
615 | 616 |
| 617 // Make sure we do not draw any transient arrangements of views. |
| 618 gfx::ScopedNSDisableScreenUpdates ns_disabler; |
616 // Make sure that any layers that move are not animated to their new | 619 // Make sure that any layers that move are not animated to their new |
617 // positions. | 620 // positions. |
618 ScopedCAActionDisabler disabler; | 621 ScopedCAActionDisabler ca_disabler; |
619 | 622 |
620 // Resize the new view to fit the window. Calling |view| may lazily | 623 // Resize the new view to fit the window. Calling |view| may lazily |
621 // instantiate the TabContentsController from the nib. Until we call | 624 // instantiate the TabContentsController from the nib. Until we call |
622 // |-ensureContentsVisible|, the controller doesn't install the RWHVMac into | 625 // |-ensureContentsVisible|, the controller doesn't install the RWHVMac into |
623 // the view hierarchy. This is in order to avoid sending the renderer a | 626 // the view hierarchy. This is in order to avoid sending the renderer a |
624 // spurious default size loaded from the nib during the call to |-view|. | 627 // spurious default size loaded from the nib during the call to |-view|. |
625 NSView* newView = [controller view]; | 628 NSView* newView = [controller view]; |
626 | 629 |
627 // Turns content autoresizing off, so removing and inserting views won't | 630 // Turns content autoresizing off, so removing and inserting views won't |
628 // trigger unnecessary content relayout. | 631 // trigger unnecessary content relayout. |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2228 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2226 // View hierarchy of the contents view: | 2229 // View hierarchy of the contents view: |
2227 // NSView -- switchView, same for all tabs | 2230 // NSView -- switchView, same for all tabs |
2228 // +- NSView -- TabContentsController's view | 2231 // +- NSView -- TabContentsController's view |
2229 // +- TabContentsViewCocoa | 2232 // +- TabContentsViewCocoa |
2230 // | 2233 // |
2231 // Changing it? Do not forget to modify | 2234 // Changing it? Do not forget to modify |
2232 // -[TabStripController swapInTabAtIndex:] too. | 2235 // -[TabStripController swapInTabAtIndex:] too. |
2233 return [web_contents->GetView()->GetNativeView() superview]; | 2236 return [web_contents->GetView()->GetNativeView() superview]; |
2234 } | 2237 } |
OLD | NEW |