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/os_exchange_data.h" | 52 #include "ui/base/dragdrop/os_exchange_data.h" |
52 #include "ui/base/events/event.h" | 53 #include "ui/base/events/event.h" |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 | 1133 |
1133 //////////////////////////////////////////////////////////////////////////////// | 1134 //////////////////////////////////////////////////////////////////////////////// |
1134 // WebContentsViewAura, WebContentsViewPort implementation: | 1135 // WebContentsViewAura, WebContentsViewPort implementation: |
1135 | 1136 |
1136 void WebContentsViewAura::CreateView( | 1137 void WebContentsViewAura::CreateView( |
1137 const gfx::Size& initial_size, gfx::NativeView context) { | 1138 const gfx::Size& initial_size, gfx::NativeView context) { |
1138 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 1139 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
1139 // if the bookmark bar is not shown and you create a new tab). The right | 1140 // if the bookmark bar is not shown and you create a new tab). The right |
1140 // value is set shortly after this, so its safe to ignore. | 1141 // value is set shortly after this, so its safe to ignore. |
1141 | 1142 |
| 1143 aura::Env::CreateInstance(); |
1142 window_.reset(new aura::Window(this)); | 1144 window_.reset(new aura::Window(this)); |
1143 window_->set_owned_by_parent(false); | 1145 window_->set_owned_by_parent(false); |
1144 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); | 1146 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); |
1145 window_->SetTransparent(false); | 1147 window_->SetTransparent(false); |
1146 window_->Init(ui::LAYER_NOT_DRAWN); | 1148 window_->Init(ui::LAYER_NOT_DRAWN); |
1147 aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; | 1149 aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; |
1148 if (root_window) { | 1150 if (root_window) { |
1149 // There are places where there is no context currently because object | 1151 // There are places where there is no context currently because object |
1150 // hierarchies are built before they're attached to a Widget. (See | 1152 // hierarchies are built before they're attached to a Widget. (See |
1151 // views::WebView as an example; GetWidget() returns NULL at the point | 1153 // views::WebView as an example; GetWidget() returns NULL at the point |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 event.location(), | 1632 event.location(), |
1631 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1633 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1632 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1634 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1633 if (drag_dest_delegate_) | 1635 if (drag_dest_delegate_) |
1634 drag_dest_delegate_->OnDrop(); | 1636 drag_dest_delegate_->OnDrop(); |
1635 current_drop_data_.reset(); | 1637 current_drop_data_.reset(); |
1636 return current_drag_op_; | 1638 return current_drag_op_; |
1637 } | 1639 } |
1638 | 1640 |
1639 } // namespace content | 1641 } // namespace content |
OLD | NEW |