| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/content/public/web_contents_view_delegate_creator.h" | 5 #include "athena/content/public/web_contents_view_delegate_creator.h" |
| 6 | 6 |
| 7 #include "athena/content/render_view_context_menu_impl.h" | 7 #include "athena/content/render_view_context_menu_impl.h" |
| 8 #include "components/web_modal/popup_manager.h" | 8 #include "components/web_modal/popup_manager.h" |
| 9 #include "components/web_modal/single_web_contents_dialog_manager.h" | 9 #include "components/web_modal/single_web_contents_dialog_manager.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class WebContentsViewDelegateImpl : public content::WebContentsViewDelegate { | 23 class WebContentsViewDelegateImpl : public content::WebContentsViewDelegate { |
| 24 public: | 24 public: |
| 25 explicit WebContentsViewDelegateImpl(content::WebContents* web_contents) | 25 explicit WebContentsViewDelegateImpl(content::WebContents* web_contents) |
| 26 : web_contents_(web_contents) {} | 26 : web_contents_(web_contents) {} |
| 27 virtual ~WebContentsViewDelegateImpl() {} | 27 virtual ~WebContentsViewDelegateImpl() {} |
| 28 | 28 |
| 29 virtual content::WebDragDestDelegate* GetDragDestDelegate() override { | 29 virtual content::WebDragDestDelegate* GetDragDestDelegate() override { |
| 30 // TODO(oshima): crbug.com/401610 | 30 // TODO(oshima): crbug.com/401610 |
| 31 NOTIMPLEMENTED(); | 31 NOTIMPLEMENTED(); |
| 32 return NULL; | 32 return nullptr; |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual bool Focus() override { | 35 virtual bool Focus() override { |
| 36 web_modal::PopupManager* popup_manager = | 36 web_modal::PopupManager* popup_manager = |
| 37 web_modal::PopupManager::FromWebContents(web_contents_); | 37 web_modal::PopupManager::FromWebContents(web_contents_); |
| 38 if (popup_manager) | 38 if (popup_manager) |
| 39 popup_manager->WasFocused(web_contents_); | 39 popup_manager->WasFocused(web_contents_); |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ->GetNativeView() | 121 ->GetNativeView() |
| 122 : web_contents_->GetNativeView(); | 122 : web_contents_->GetNativeView(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 views::Widget* GetTopLevelWidget() { | 125 views::Widget* GetTopLevelWidget() { |
| 126 return views::Widget::GetTopLevelWidgetForNativeView(GetActiveNativeView()); | 126 return views::Widget::GetTopLevelWidgetForNativeView(GetActiveNativeView()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 views::FocusManager* GetFocusManager() { | 129 views::FocusManager* GetFocusManager() { |
| 130 views::Widget* toplevel_widget = GetTopLevelWidget(); | 130 views::Widget* toplevel_widget = GetTopLevelWidget(); |
| 131 return toplevel_widget ? toplevel_widget->GetFocusManager() : NULL; | 131 return toplevel_widget ? toplevel_widget->GetFocusManager() : nullptr; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SetInitialFocus() { | 134 void SetInitialFocus() { |
| 135 if (web_contents_->FocusLocationBarByDefault()) { | 135 if (web_contents_->FocusLocationBarByDefault()) { |
| 136 if (web_contents_->GetDelegate()) | 136 if (web_contents_->GetDelegate()) |
| 137 web_contents_->GetDelegate()->SetFocusToLocationBar(false); | 137 web_contents_->GetDelegate()->SetFocusToLocationBar(false); |
| 138 } else { | 138 } else { |
| 139 web_contents_->Focus(); | 139 web_contents_->Focus(); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 scoped_ptr<RenderViewContextMenuImpl> context_menu_; | 142 scoped_ptr<RenderViewContextMenuImpl> context_menu_; |
| 143 content::WebContents* web_contents_; | 143 content::WebContents* web_contents_; |
| 144 DISALLOW_COPY_AND_ASSIGN(WebContentsViewDelegateImpl); | 144 DISALLOW_COPY_AND_ASSIGN(WebContentsViewDelegateImpl); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace | 147 } // namespace |
| 148 | 148 |
| 149 content::WebContentsViewDelegate* CreateWebContentsViewDelegate( | 149 content::WebContentsViewDelegate* CreateWebContentsViewDelegate( |
| 150 content::WebContents* web_contents) { | 150 content::WebContents* web_contents) { |
| 151 return new WebContentsViewDelegateImpl(web_contents); | 151 return new WebContentsViewDelegateImpl(web_contents); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace athena | 154 } // namespace athena |
| OLD | NEW |