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 #include "chrome/browser/ui/views/frame/instant_preview_controller_views.h" | 5 #include "chrome/browser/ui/views/frame/instant_preview_controller_views.h" |
6 | 6 |
7 #include "chrome/browser/instant/instant_model.h" | 7 #include "chrome/browser/instant/instant_model.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/view_ids.h" | 10 #include "chrome/browser/ui/view_ids.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Show the preview. | 28 // Show the preview. |
29 if (!preview_) { | 29 if (!preview_) { |
30 preview_.reset(new views::WebView(browser_->profile())); | 30 preview_.reset(new views::WebView(browser_->profile())); |
31 preview_->set_id(VIEW_ID_TAB_CONTAINER); | 31 preview_->set_id(VIEW_ID_TAB_CONTAINER); |
32 } | 32 } |
33 // Drop shadow is only needed if search mode is not |NTP| and preview does | 33 // Drop shadow is only needed if search mode is not |NTP| and preview does |
34 // not fill up the entire contents page. | 34 // not fill up the entire contents page. |
35 bool draw_drop_shadow = !model.mode().is_ntp() && | 35 bool draw_drop_shadow = !model.mode().is_ntp() && |
36 !(contents_->IsPreviewFullHeight(model.height(), model.height_units())); | 36 !(contents_->IsPreviewFullHeight(model.height(), model.height_units())); |
37 content::WebContents* web_contents = model.GetPreviewContents(); | 37 content::WebContents* web_contents = model.GetPreviewContents(); |
38 contents_->SetPreview(preview_.get(), web_contents, | 38 contents_->SetPreview(preview_.get(), web_contents, model.mode(), |
39 model.height(), model.height_units(), | 39 model.height(), model.height_units(), |
40 draw_drop_shadow); | 40 draw_drop_shadow); |
41 preview_->SetWebContents(web_contents); | 41 preview_->SetWebContents(web_contents); |
42 } else if (preview_) { | 42 } else if (preview_) { |
43 // Hide the preview. SetWebContents() must happen before SetPreview(). | 43 // Hide the preview. SetWebContents() must happen before SetPreview(). |
44 preview_->SetWebContents(NULL); | 44 preview_->SetWebContents(NULL); |
45 contents_->SetPreview(NULL, NULL, 100, INSTANT_SIZE_PERCENT, false); | 45 contents_->SetPreview(NULL, NULL, model.mode(), 100, INSTANT_SIZE_PERCENT, |
| 46 false); |
46 preview_.reset(); | 47 preview_.reset(); |
47 } | 48 } |
48 | 49 |
49 browser_->MaybeUpdateBookmarkBarStateForInstantPreview(model.mode()); | 50 browser_->MaybeUpdateBookmarkBarStateForInstantPreview(model.mode()); |
50 | 51 |
51 // If an instant preview is added during an immersive mode reveal, the reveal | 52 // If an instant preview is added during an immersive mode reveal, the reveal |
52 // view needs to stay on top. | 53 // view needs to stay on top. |
53 if (preview_) { | 54 if (preview_) { |
54 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 55 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
55 if (browser_view) | 56 if (browser_view) |
56 browser_view->MaybeStackImmersiveRevealAtTop(); | 57 browser_view->MaybeStackImmersiveRevealAtTop(); |
57 } | 58 } |
58 } | 59 } |
OLD | NEW |