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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.mm

Issue 10959049: Change visibility semantics for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enable a test Created 8 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/previewable_contents_controller.h" 5 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 15 matching lines...) Expand all
26 DCHECK(preview); 26 DCHECK(preview);
27 27
28 // Remove any old preview contents before showing the new one. 28 // Remove any old preview contents before showing the new one.
29 if (previewContents_) 29 if (previewContents_)
30 [previewContents_->GetNativeView() removeFromSuperview]; 30 [previewContents_->GetNativeView() removeFromSuperview];
31 31
32 previewContents_ = preview; 32 previewContents_ = preview;
33 NSView* previewView = previewContents_->GetNativeView(); 33 NSView* previewView = previewContents_->GetNativeView();
34 [previewView setFrame:[[self view] bounds]]; 34 [previewView setFrame:[[self view] bounds]];
35 35
36 // Hide the active container and add the preview contents. 36 // Add the preview contents.
37 [activeContainer_ setHidden:YES];
38 [[self view] addSubview:previewView]; 37 [[self view] addSubview:previewView];
38 previewContents_->WasShown();
39 } 39 }
40 40
41 - (void)hidePreview { 41 - (void)hidePreview {
42 // There may be no previewContents_ in the prerender case. 42 // There may be no previewContents_ in the prerender case.
43 if (!previewContents_) 43 if (!previewContents_)
44 return; 44 return;
45 45
46 // Remove the preview contents and reshow the active container. 46 // Remove the preview contents.
47 [previewContents_->GetNativeView() removeFromSuperview]; 47 [previewContents_->GetNativeView() removeFromSuperview];
48 [activeContainer_ setHidden:NO]; 48 previewContents_->WasHidden();
49
50 previewContents_ = nil; 49 previewContents_ = nil;
51 } 50 }
52 51
53 - (BOOL)isShowingPreview { 52 - (BOOL)isShowingPreview {
54 return previewContents_ != nil; 53 return previewContents_ != nil;
55 } 54 }
56 55
57 @end 56 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.cc ('k') | chrome/browser/ui/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698