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 #include "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 current_overscroll_gesture_); | 821 current_overscroll_gesture_); |
822 scoped_ptr<aura::Window> reset_window(overscroll_window_.release()); | 822 scoped_ptr<aura::Window> reset_window(overscroll_window_.release()); |
823 } | 823 } |
824 | 824 |
825 OverscrollWindowDelegate* overscroll_delegate = new OverscrollWindowDelegate( | 825 OverscrollWindowDelegate* overscroll_delegate = new OverscrollWindowDelegate( |
826 web_contents_, | 826 web_contents_, |
827 current_overscroll_gesture_); | 827 current_overscroll_gesture_); |
828 overscroll_window_.reset(new aura::Window(overscroll_delegate)); | 828 overscroll_window_.reset(new aura::Window(overscroll_delegate)); |
829 overscroll_window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 829 overscroll_window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
830 overscroll_window_->SetTransparent(true); | 830 overscroll_window_->SetTransparent(true); |
831 overscroll_window_->Init(aura::WINDOW_LAYER_TEXTURED); | 831 overscroll_window_->Init(ui::LAYER_TEXTURED); |
832 overscroll_window_->layer()->SetMasksToBounds(false); | 832 overscroll_window_->layer()->SetMasksToBounds(false); |
833 overscroll_window_->SetName("OverscrollOverlay"); | 833 overscroll_window_->SetName("OverscrollOverlay"); |
834 | 834 |
835 overscroll_change_brightness_ = overscroll_delegate->has_image(); | 835 overscroll_change_brightness_ = overscroll_delegate->has_image(); |
836 window_->AddChild(overscroll_window_.get()); | 836 window_->AddChild(overscroll_window_.get()); |
837 | 837 |
838 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); | 838 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); |
839 if (ShouldNavigateForward(web_contents_->GetController(), | 839 if (ShouldNavigateForward(web_contents_->GetController(), |
840 current_overscroll_gesture_)) { | 840 current_overscroll_gesture_)) { |
841 // The overlay will be sliding in from the right edge towards the left in | 841 // The overlay will be sliding in from the right edge towards the left in |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 const gfx::Size& initial_size, gfx::NativeView context) { | 1076 const gfx::Size& initial_size, gfx::NativeView context) { |
1077 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 1077 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
1078 // if the bookmark bar is not shown and you create a new tab). The right | 1078 // if the bookmark bar is not shown and you create a new tab). The right |
1079 // value is set shortly after this, so its safe to ignore. | 1079 // value is set shortly after this, so its safe to ignore. |
1080 | 1080 |
1081 aura::Env::CreateInstance(true); | 1081 aura::Env::CreateInstance(true); |
1082 window_.reset(new aura::Window(this)); | 1082 window_.reset(new aura::Window(this)); |
1083 window_->set_owned_by_parent(false); | 1083 window_->set_owned_by_parent(false); |
1084 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 1084 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
1085 window_->SetTransparent(false); | 1085 window_->SetTransparent(false); |
1086 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 1086 window_->Init(ui::LAYER_NOT_DRAWN); |
1087 window_->AddObserver(this); | 1087 window_->AddObserver(this); |
1088 aura::Window* root_window = context ? context->GetRootWindow() : NULL; | 1088 aura::Window* root_window = context ? context->GetRootWindow() : NULL; |
1089 if (root_window) { | 1089 if (root_window) { |
1090 // There are places where there is no context currently because object | 1090 // There are places where there is no context currently because object |
1091 // hierarchies are built before they're attached to a Widget. (See | 1091 // hierarchies are built before they're attached to a Widget. (See |
1092 // views::WebView as an example; GetWidget() returns NULL at the point | 1092 // views::WebView as an example; GetWidget() returns NULL at the point |
1093 // where we are created.) | 1093 // where we are created.) |
1094 // | 1094 // |
1095 // It should be OK to not set a default parent since such users will | 1095 // It should be OK to not set a default parent since such users will |
1096 // explicitly add this WebContentsViewAura to their tree after they create | 1096 // explicitly add this WebContentsViewAura to their tree after they create |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 if (visible) { | 1641 if (visible) { |
1642 if (!web_contents_->should_normally_be_visible()) | 1642 if (!web_contents_->should_normally_be_visible()) |
1643 web_contents_->WasShown(); | 1643 web_contents_->WasShown(); |
1644 } else { | 1644 } else { |
1645 if (web_contents_->should_normally_be_visible()) | 1645 if (web_contents_->should_normally_be_visible()) |
1646 web_contents_->WasHidden(); | 1646 web_contents_->WasHidden(); |
1647 } | 1647 } |
1648 } | 1648 } |
1649 | 1649 |
1650 } // namespace content | 1650 } // namespace content |
OLD | NEW |