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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 current_overscroll_gesture_); | 958 current_overscroll_gesture_); |
959 scoped_ptr<aura::Window> reset_window(overscroll_window_.release()); | 959 scoped_ptr<aura::Window> reset_window(overscroll_window_.release()); |
960 } | 960 } |
961 | 961 |
962 OverscrollWindowDelegate* overscroll_delegate = new OverscrollWindowDelegate( | 962 OverscrollWindowDelegate* overscroll_delegate = new OverscrollWindowDelegate( |
963 web_contents_, | 963 web_contents_, |
964 current_overscroll_gesture_); | 964 current_overscroll_gesture_); |
965 overscroll_window_.reset(new aura::Window(overscroll_delegate)); | 965 overscroll_window_.reset(new aura::Window(overscroll_delegate)); |
966 overscroll_window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 966 overscroll_window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
967 overscroll_window_->SetTransparent(true); | 967 overscroll_window_->SetTransparent(true); |
968 overscroll_window_->Init(ui::LAYER_TEXTURED); | 968 overscroll_window_->Init(aura::WINDOW_LAYER_TEXTURED); |
969 overscroll_window_->layer()->SetMasksToBounds(false); | 969 overscroll_window_->layer()->SetMasksToBounds(false); |
970 overscroll_window_->SetName("OverscrollOverlay"); | 970 overscroll_window_->SetName("OverscrollOverlay"); |
971 | 971 |
972 overscroll_change_brightness_ = overscroll_delegate->has_image(); | 972 overscroll_change_brightness_ = overscroll_delegate->has_image(); |
973 window_->AddChild(overscroll_window_.get()); | 973 window_->AddChild(overscroll_window_.get()); |
974 | 974 |
975 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); | 975 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); |
976 if (ShouldNavigateForward(web_contents_->GetController(), | 976 if (ShouldNavigateForward(web_contents_->GetController(), |
977 current_overscroll_gesture_)) { | 977 current_overscroll_gesture_)) { |
978 // The overlay will be sliding in from the right edge towards the left in | 978 // The overlay will be sliding in from the right edge towards the left in |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 const gfx::Size& initial_size, gfx::NativeView context) { | 1211 const gfx::Size& initial_size, gfx::NativeView context) { |
1212 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 1212 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
1213 // if the bookmark bar is not shown and you create a new tab). The right | 1213 // if the bookmark bar is not shown and you create a new tab). The right |
1214 // value is set shortly after this, so its safe to ignore. | 1214 // value is set shortly after this, so its safe to ignore. |
1215 | 1215 |
1216 aura::Env::CreateInstance(); | 1216 aura::Env::CreateInstance(); |
1217 window_.reset(new aura::Window(this)); | 1217 window_.reset(new aura::Window(this)); |
1218 window_->set_owned_by_parent(false); | 1218 window_->set_owned_by_parent(false); |
1219 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 1219 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
1220 window_->SetTransparent(false); | 1220 window_->SetTransparent(false); |
1221 window_->Init(ui::LAYER_NOT_DRAWN); | 1221 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
1222 aura::Window* root_window = context ? context->GetRootWindow() : NULL; | 1222 aura::Window* root_window = context ? context->GetRootWindow() : NULL; |
1223 if (root_window) { | 1223 if (root_window) { |
1224 // There are places where there is no context currently because object | 1224 // There are places where there is no context currently because object |
1225 // hierarchies are built before they're attached to a Widget. (See | 1225 // hierarchies are built before they're attached to a Widget. (See |
1226 // views::WebView as an example; GetWidget() returns NULL at the point | 1226 // views::WebView as an example; GetWidget() returns NULL at the point |
1227 // where we are created.) | 1227 // where we are created.) |
1228 // | 1228 // |
1229 // It should be OK to not set a default parent since such users will | 1229 // It should be OK to not set a default parent since such users will |
1230 // explicitly add this WebContentsViewAura to their tree after they create | 1230 // explicitly add this WebContentsViewAura to their tree after they create |
1231 // us. | 1231 // us. |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 event.location(), | 1722 event.location(), |
1723 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1723 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1724 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1724 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1725 if (drag_dest_delegate_) | 1725 if (drag_dest_delegate_) |
1726 drag_dest_delegate_->OnDrop(); | 1726 drag_dest_delegate_->OnDrop(); |
1727 current_drop_data_.reset(); | 1727 current_drop_data_.reset(); |
1728 return current_drag_op_; | 1728 return current_drag_op_; |
1729 } | 1729 } |
1730 | 1730 |
1731 } // namespace content | 1731 } // namespace content |
OLD | NEW |