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 22 matching lines...) Expand all Loading... |
33 #include "content/public/browser/web_contents_observer.h" | 33 #include "content/public/browser/web_contents_observer.h" |
34 #include "content/public/browser/web_contents_view_delegate.h" | 34 #include "content/public/browser/web_contents_view_delegate.h" |
35 #include "content/public/browser/web_drag_dest_delegate.h" | 35 #include "content/public/browser/web_drag_dest_delegate.h" |
36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/drop_data.h" | 37 #include "content/public/common/drop_data.h" |
38 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
39 #include "third_party/WebKit/public/web/WebInputEvent.h" | 39 #include "third_party/WebKit/public/web/WebInputEvent.h" |
40 #include "ui/aura/client/aura_constants.h" | 40 #include "ui/aura/client/aura_constants.h" |
41 #include "ui/aura/client/drag_drop_client.h" | 41 #include "ui/aura/client/drag_drop_client.h" |
42 #include "ui/aura/client/drag_drop_delegate.h" | 42 #include "ui/aura/client/drag_drop_delegate.h" |
| 43 #include "ui/aura/env.h" |
43 #include "ui/aura/root_window.h" | 44 #include "ui/aura/root_window.h" |
44 #include "ui/aura/root_window_observer.h" | 45 #include "ui/aura/root_window_observer.h" |
45 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
46 #include "ui/aura/window_observer.h" | 47 #include "ui/aura/window_observer.h" |
47 #include "ui/base/clipboard/clipboard.h" | 48 #include "ui/base/clipboard/clipboard.h" |
48 #include "ui/base/clipboard/custom_data_helper.h" | 49 #include "ui/base/clipboard/custom_data_helper.h" |
49 #include "ui/base/dragdrop/drag_drop_types.h" | 50 #include "ui/base/dragdrop/drag_drop_types.h" |
50 #include "ui/base/dragdrop/drag_utils.h" | 51 #include "ui/base/dragdrop/drag_utils.h" |
51 #include "ui/base/dragdrop/drop_target_event.h" | 52 #include "ui/base/dragdrop/drop_target_event.h" |
52 #include "ui/base/dragdrop/os_exchange_data.h" | 53 #include "ui/base/dragdrop/os_exchange_data.h" |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1136 |
1136 //////////////////////////////////////////////////////////////////////////////// | 1137 //////////////////////////////////////////////////////////////////////////////// |
1137 // WebContentsViewAura, WebContentsViewPort implementation: | 1138 // WebContentsViewAura, WebContentsViewPort implementation: |
1138 | 1139 |
1139 void WebContentsViewAura::CreateView( | 1140 void WebContentsViewAura::CreateView( |
1140 const gfx::Size& initial_size, gfx::NativeView context) { | 1141 const gfx::Size& initial_size, gfx::NativeView context) { |
1141 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 1142 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
1142 // if the bookmark bar is not shown and you create a new tab). The right | 1143 // if the bookmark bar is not shown and you create a new tab). The right |
1143 // value is set shortly after this, so its safe to ignore. | 1144 // value is set shortly after this, so its safe to ignore. |
1144 | 1145 |
| 1146 aura::Env::CreateInstance(); |
1145 window_.reset(new aura::Window(this)); | 1147 window_.reset(new aura::Window(this)); |
1146 window_->set_owned_by_parent(false); | 1148 window_->set_owned_by_parent(false); |
1147 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); | 1149 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); |
1148 window_->SetTransparent(false); | 1150 window_->SetTransparent(false); |
1149 window_->Init(ui::LAYER_NOT_DRAWN); | 1151 window_->Init(ui::LAYER_NOT_DRAWN); |
1150 aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; | 1152 aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; |
1151 if (root_window) { | 1153 if (root_window) { |
1152 // There are places where there is no context currently because object | 1154 // There are places where there is no context currently because object |
1153 // hierarchies are built before they're attached to a Widget. (See | 1155 // hierarchies are built before they're attached to a Widget. (See |
1154 // views::WebView as an example; GetWidget() returns NULL at the point | 1156 // views::WebView as an example; GetWidget() returns NULL at the point |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 event.location(), | 1635 event.location(), |
1634 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1636 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1635 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1637 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1636 if (drag_dest_delegate_) | 1638 if (drag_dest_delegate_) |
1637 drag_dest_delegate_->OnDrop(); | 1639 drag_dest_delegate_->OnDrop(); |
1638 current_drop_data_.reset(); | 1640 current_drop_data_.reset(); |
1639 return current_drag_op_; | 1641 return current_drag_op_; |
1640 } | 1642 } |
1641 | 1643 |
1642 } // namespace content | 1644 } // namespace content |
OLD | NEW |