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

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

Issue 697223003: MacViews: Get chrome/browser/ui/views/frame to compile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@constrained
Patch Set: Rebase. Add mac_views_browser build flag 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/aura/window.h"
tapted 2014/11/04 02:33:43 guard this?
Andre 2014/11/05 02:04:23 Done.
11 #include "ui/base/theme_provider.h" 11 #include "ui/base/theme_provider.h"
12 #include "ui/compositor/layer_tree_owner.h" 12 #include "ui/compositor/layer_tree_owner.h"
13 #include "ui/views/background.h" 13 #include "ui/views/background.h"
14 #include "ui/wm/core/window_util.h" 14 #include "ui/wm/core/window_util.h"
tapted 2014/11/04 02:33:43 guard this?
Andre 2014/11/05 02:04:23 Done.
15 15
16 ContentsWebView::ContentsWebView(content::BrowserContext* browser_context) 16 ContentsWebView::ContentsWebView(content::BrowserContext* browser_context)
17 : views::WebView(browser_context), 17 : views::WebView(browser_context),
18 status_bubble_(NULL) { 18 status_bubble_(NULL) {
19 } 19 }
20 20
21 ContentsWebView::~ContentsWebView() { 21 ContentsWebView::~ContentsWebView() {
22 } 22 }
23 23
24 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
76 // 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
77 // 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
78 // up owning the layer (and all its descendants). 78 // up owning the layer (and all its descendants).
79 old_layer->Add(cloned_layer_tree_->release()); 79 old_layer->Add(cloned_layer_tree_->release());
80 cloned_layer_tree_.reset(); 80 cloned_layer_tree_.reset();
81 } 81 }
82 82
83 void ContentsWebView::CloneWebContentsLayer() { 83 void ContentsWebView::CloneWebContentsLayer() {
84 if (!web_contents()) 84 if (!web_contents())
85 return; 85 return;
86 #if defined(USE_AURA)
87 // TODO(andresantoso): Figure out how to port this for MacViews.
86 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView()); 88 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView());
tapted 2014/11/04 02:33:43 So, after poking some more, I think this won't be
Andre 2014/11/05 02:04:23 Done. Thanks for figuring it out.
89 #endif
87 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { 90 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) {
88 cloned_layer_tree_.reset(); 91 cloned_layer_tree_.reset();
89 return; 92 return;
90 } 93 }
91 94
92 SetPaintToLayer(true); 95 SetPaintToLayer(true);
93 set_layer_owner_delegate(this); 96 set_layer_owner_delegate(this);
94 97
95 // The cloned layer is in a different coordinate system them our layer (which 98 // The cloned layer is in a different coordinate system them our layer (which
96 // is now the new parent of the cloned layer). Convert coordinates so that the 99 // is now the new parent of the cloned layer). Convert coordinates so that the
97 // cloned layer appears at the right location. 100 // cloned layer appears at the right location.
98 gfx::Point origin; 101 gfx::Point origin;
99 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin); 102 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin);
100 cloned_layer_tree_->root()->SetBounds( 103 cloned_layer_tree_->root()->SetBounds(
101 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); 104 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size()));
102 layer()->Add(cloned_layer_tree_->root()); 105 layer()->Add(cloned_layer_tree_->root());
103 } 106 }
104 107
105 void ContentsWebView::DestroyClonedLayer() { 108 void ContentsWebView::DestroyClonedLayer() {
106 cloned_layer_tree_.reset(); 109 cloned_layer_tree_.reset();
107 SetPaintToLayer(false); 110 SetPaintToLayer(false);
108 set_layer_owner_delegate(NULL); 111 set_layer_owner_delegate(NULL);
109 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698