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

Side by Side Diff: chrome/browser/ui/views/frame/contents_web_view.cc

Issue 716463002: Revert "MacViews: Get chrome/browser/ui/views/frame to compile" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/contents_web_view.h" 5 #include "chrome/browser/ui/views/frame/contents_web_view.h"
6 6
7 #include "chrome/browser/themes/theme_properties.h" 7 #include "chrome/browser/themes/theme_properties.h"
8 #include "chrome/browser/ui/views/status_bubble_views.h" 8 #include "chrome/browser/ui/views/status_bubble_views.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/aura/window.h"
10 #include "ui/base/theme_provider.h" 11 #include "ui/base/theme_provider.h"
11 #include "ui/compositor/layer_tree_owner.h" 12 #include "ui/compositor/layer_tree_owner.h"
12 #include "ui/views/background.h" 13 #include "ui/views/background.h"
13
14 #if defined(USE_AURA)
15 #include "ui/aura/window.h"
16 #include "ui/wm/core/window_util.h" 14 #include "ui/wm/core/window_util.h"
17 #endif
18 15
19 ContentsWebView::ContentsWebView(content::BrowserContext* browser_context) 16 ContentsWebView::ContentsWebView(content::BrowserContext* browser_context)
20 : views::WebView(browser_context), 17 : views::WebView(browser_context),
21 status_bubble_(NULL) { 18 status_bubble_(NULL) {
22 } 19 }
23 20
24 ContentsWebView::~ContentsWebView() { 21 ContentsWebView::~ContentsWebView() {
25 } 22 }
26 23
27 void ContentsWebView::SetStatusBubble(StatusBubbleViews* status_bubble) { 24 void ContentsWebView::SetStatusBubble(StatusBubbleViews* status_bubble) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // want the WebContents layer clone to be animated we move it to the 76 // want the WebContents layer clone to be animated we move it to the
80 // old_layer, which is the layer the animation happens on. This animation ends 77 // old_layer, which is the layer the animation happens on. This animation ends
81 // up owning the layer (and all its descendants). 78 // up owning the layer (and all its descendants).
82 old_layer->Add(cloned_layer_tree_->release()); 79 old_layer->Add(cloned_layer_tree_->release());
83 cloned_layer_tree_.reset(); 80 cloned_layer_tree_.reset();
84 } 81 }
85 82
86 void ContentsWebView::CloneWebContentsLayer() { 83 void ContentsWebView::CloneWebContentsLayer() {
87 if (!web_contents()) 84 if (!web_contents())
88 return; 85 return;
89 #if defined(USE_AURA)
90 // We don't need to clone the layers on non-Aura (Mac), because closing an
91 // NSWindow does not animate.
92 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView()); 86 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView());
93 #endif
94 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { 87 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) {
95 cloned_layer_tree_.reset(); 88 cloned_layer_tree_.reset();
96 return; 89 return;
97 } 90 }
98 91
99 SetPaintToLayer(true); 92 SetPaintToLayer(true);
100 set_layer_owner_delegate(this); 93 set_layer_owner_delegate(this);
101 94
102 // The cloned layer is in a different coordinate system them our layer (which 95 // The cloned layer is in a different coordinate system them our layer (which
103 // is now the new parent of the cloned layer). Convert coordinates so that the 96 // is now the new parent of the cloned layer). Convert coordinates so that the
104 // cloned layer appears at the right location. 97 // cloned layer appears at the right location.
105 gfx::Point origin; 98 gfx::Point origin;
106 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin); 99 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin);
107 cloned_layer_tree_->root()->SetBounds( 100 cloned_layer_tree_->root()->SetBounds(
108 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); 101 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size()));
109 layer()->Add(cloned_layer_tree_->root()); 102 layer()->Add(cloned_layer_tree_->root());
110 } 103 }
111 104
112 void ContentsWebView::DestroyClonedLayer() { 105 void ContentsWebView::DestroyClonedLayer() {
113 cloned_layer_tree_.reset(); 106 cloned_layer_tree_.reset();
114 SetPaintToLayer(false); 107 SetPaintToLayer(false);
115 set_layer_owner_delegate(NULL); 108 set_layer_owner_delegate(NULL);
116 } 109 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_window_factory.cc ('k') | chrome/browser/ui/views/frame/desktop_browser_frame_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698