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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 //////////////////////////////////////////////////////////////////////////////// | 778 //////////////////////////////////////////////////////////////////////////////// |
779 // WebContentsViewAura, WebContentsView implementation: | 779 // WebContentsViewAura, WebContentsView implementation: |
780 | 780 |
781 void WebContentsViewAura::CreateView( | 781 void WebContentsViewAura::CreateView( |
782 const gfx::Size& initial_size, gfx::NativeView context) { | 782 const gfx::Size& initial_size, gfx::NativeView context) { |
783 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 783 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
784 // if the bookmark bar is not shown and you create a new tab). The right | 784 // if the bookmark bar is not shown and you create a new tab). The right |
785 // value is set shortly after this, so its safe to ignore. | 785 // value is set shortly after this, so its safe to ignore. |
786 | 786 |
787 DCHECK(aura::Env::GetInstanceDontCreate()); | 787 DCHECK(aura::Env::GetInstanceDontCreate()); |
788 window_.reset(new aura::Window(this)); | 788 window_ = base::MakeUnique<aura::Window>(this); |
789 window_->set_owned_by_parent(false); | 789 window_->set_owned_by_parent(false); |
790 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 790 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 791 window_->SetName("WebContentsViewAura"); |
791 window_->Init(ui::LAYER_NOT_DRAWN); | 792 window_->Init(ui::LAYER_NOT_DRAWN); |
792 window_->AddObserver(this); | 793 window_->AddObserver(this); |
793 aura::Window* root_window = context ? context->GetRootWindow() : NULL; | 794 aura::Window* root_window = context ? context->GetRootWindow() : nullptr; |
794 if (root_window) { | 795 if (root_window) { |
795 // There are places where there is no context currently because object | 796 // There are places where there is no context currently because object |
796 // hierarchies are built before they're attached to a Widget. (See | 797 // hierarchies are built before they're attached to a Widget. (See |
797 // views::WebView as an example; GetWidget() returns NULL at the point | 798 // views::WebView as an example; GetWidget() returns NULL at the point |
798 // where we are created.) | 799 // where we are created.) |
799 // | 800 // |
800 // It should be OK to not set a default parent since such users will | 801 // It should be OK to not set a default parent since such users will |
801 // explicitly add this WebContentsViewAura to their tree after they create | 802 // explicitly add this WebContentsViewAura to their tree after they create |
802 // us. | 803 // us. |
803 aura::client::ParentWindowWithContext(window_.get(), root_window, | 804 aura::client::ParentWindowWithContext(window_.get(), root_window, |
804 root_window->GetBoundsInScreen()); | 805 root_window->GetBoundsInScreen()); |
805 } | 806 } |
806 window_->layer()->SetMasksToBounds(true); | 807 window_->layer()->SetMasksToBounds(true); |
807 window_->SetName("WebContentsViewAura"); | |
808 | 808 |
809 // WindowObserver is not interesting and is problematic for Browser Plugin | 809 // WindowObserver is not interesting and is problematic for Browser Plugin |
810 // guests. | 810 // guests. |
811 // The use cases for WindowObserver do not apply to Browser Plugins: | 811 // The use cases for WindowObserver do not apply to Browser Plugins: |
812 // 1) guests do not support NPAPI plugins. | 812 // 1) guests do not support NPAPI plugins. |
813 // 2) guests' window bounds are supposed to come from its embedder. | 813 // 2) guests' window bounds are supposed to come from its embedder. |
814 if (!BrowserPluginGuest::IsGuest(web_contents_)) | 814 if (!BrowserPluginGuest::IsGuest(web_contents_)) |
815 window_observer_.reset(new WindowObserver(this)); | 815 window_observer_.reset(new WindowObserver(this)); |
816 | 816 |
817 // delegate_->GetDragDestDelegate() creates a new delegate on every call. | 817 // delegate_->GetDragDestDelegate() creates a new delegate on every call. |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 bool allow_multiple_selection) { | 1295 bool allow_multiple_selection) { |
1296 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1296 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
1297 } | 1297 } |
1298 | 1298 |
1299 void WebContentsViewAura::HidePopupMenu() { | 1299 void WebContentsViewAura::HidePopupMenu() { |
1300 NOTIMPLEMENTED(); | 1300 NOTIMPLEMENTED(); |
1301 } | 1301 } |
1302 #endif | 1302 #endif |
1303 | 1303 |
1304 } // namespace content | 1304 } // namespace content |
OLD | NEW |