Commit 35bf0120 authored by David Black's avatar David Black Committed by Commit Bot

Rename AssistantWebView2 to AssistantWebView.

The name AssistantWebView is now freed up in Ash and can be used by
the AssistantWebView2 interface.

Bug: b:146520500
Change-Id: I9ddb0e5e7fe9697a7cc3a350e8607c973d4f22bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040733
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739143}
parent 508ff059
...@@ -12,7 +12,7 @@ namespace ash { ...@@ -12,7 +12,7 @@ namespace ash {
// AssistantCardElement::Processor --------------------------------------------- // AssistantCardElement::Processor ---------------------------------------------
class AssistantCardElement::Processor : public AssistantWebView2::Observer { class AssistantCardElement::Processor : public AssistantWebView::Observer {
public: public:
Processor(AssistantCardElement& card_element, ProcessingCallback callback) Processor(AssistantCardElement& card_element, ProcessingCallback callback)
: card_element_(card_element), callback_(std::move(callback)) {} : card_element_(card_element), callback_(std::move(callback)) {}
...@@ -34,7 +34,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer { ...@@ -34,7 +34,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer {
kPreferredWidthDip - 2 * kUiElementHorizontalMarginDip; kPreferredWidthDip - 2 * kUiElementHorizontalMarginDip;
// Configure parameters for the card. // Configure parameters for the card.
AssistantWebView2::InitParams contents_params; AssistantWebView::InitParams contents_params;
contents_params.enable_auto_resize = true; contents_params.enable_auto_resize = true;
contents_params.min_size = gfx::Size(width_dip, 1); contents_params.min_size = gfx::Size(width_dip, 1);
contents_params.max_size = gfx::Size(width_dip, INT_MAX); contents_params.max_size = gfx::Size(width_dip, INT_MAX);
...@@ -59,7 +59,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer { ...@@ -59,7 +59,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer {
} }
private: private:
// AssistantWebView2::Observer: // AssistantWebView::Observer:
void DidStopLoading() override { void DidStopLoading() override {
contents_view_->RemoveObserver(this); contents_view_->RemoveObserver(this);
...@@ -72,7 +72,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer { ...@@ -72,7 +72,7 @@ class AssistantCardElement::Processor : public AssistantWebView2::Observer {
AssistantCardElement& card_element_; AssistantCardElement& card_element_;
ProcessingCallback callback_; ProcessingCallback callback_;
std::unique_ptr<AssistantWebView2> contents_view_; std::unique_ptr<AssistantWebView> contents_view_;
}; };
// AssistantCardElement -------------------------------------------------------- // AssistantCardElement --------------------------------------------------------
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <string> #include <string>
#include "ash/assistant/model/ui/assistant_ui_element.h" #include "ash/assistant/model/ui/assistant_ui_element.h"
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "base/component_export.h" #include "base/component_export.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -30,12 +30,9 @@ class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantCardElement ...@@ -30,12 +30,9 @@ class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantCardElement
const std::string& html() const { return html_; } const std::string& html() const { return html_; }
const std::string& fallback() const { return fallback_; } const std::string& fallback() const { return fallback_; }
const AssistantWebView* contents_view() const { return contents_view_.get(); }
const AssistantWebView2* contents_view() const { void set_contents_view(std::unique_ptr<AssistantWebView> contents_view) {
return contents_view_.get();
}
void set_contents_view(std::unique_ptr<AssistantWebView2> contents_view) {
contents_view_ = std::move(contents_view); contents_view_ = std::move(contents_view);
} }
...@@ -44,7 +41,7 @@ class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantCardElement ...@@ -44,7 +41,7 @@ class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantCardElement
const std::string html_; const std::string html_;
const std::string fallback_; const std::string fallback_;
std::unique_ptr<AssistantWebView2> contents_view_; std::unique_ptr<AssistantWebView> contents_view_;
std::unique_ptr<Processor> processor_; std::unique_ptr<Processor> processor_;
......
...@@ -5,20 +5,21 @@ ...@@ -5,20 +5,21 @@
#ifndef ASH_ASSISTANT_TEST_TEST_ASSISTANT_WEB_VIEW_H_ #ifndef ASH_ASSISTANT_TEST_TEST_ASSISTANT_WEB_VIEW_H_
#define ASH_ASSISTANT_TEST_TEST_ASSISTANT_WEB_VIEW_H_ #define ASH_ASSISTANT_TEST_TEST_ASSISTANT_WEB_VIEW_H_
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "base/observer_list.h" #include "base/observer_list.h"
namespace ash { namespace ash {
// An implementation of AssistantWebView2 for use in unittests. // An implementation of AssistantWebView for use in unittests.
class TestAssistantWebView : public AssistantWebView2 { class TestAssistantWebView : public AssistantWebView {
public: public:
TestAssistantWebView(); TestAssistantWebView();
TestAssistantWebView(const TestAssistantWebView& copy) = delete;
TestAssistantWebView& operator=(const TestAssistantWebView& assign) = delete;
~TestAssistantWebView() override; ~TestAssistantWebView() override;
// AssistantWebView2: TestAssistantWebView(const TestAssistantWebView&) = delete;
TestAssistantWebView& operator=(const TestAssistantWebView&) = delete;
// AssistantWebView:
void AddObserver(Observer* observer) override; void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override; void RemoveObserver(Observer* observer) override;
gfx::NativeView GetNativeView() override; gfx::NativeView GetNativeView() override;
......
...@@ -12,8 +12,8 @@ TestAssistantWebViewFactory::TestAssistantWebViewFactory() = default; ...@@ -12,8 +12,8 @@ TestAssistantWebViewFactory::TestAssistantWebViewFactory() = default;
TestAssistantWebViewFactory::~TestAssistantWebViewFactory() = default; TestAssistantWebViewFactory::~TestAssistantWebViewFactory() = default;
std::unique_ptr<AssistantWebView2> TestAssistantWebViewFactory::Create( std::unique_ptr<AssistantWebView> TestAssistantWebViewFactory::Create(
const AssistantWebView2::InitParams& params) { const AssistantWebView::InitParams& params) {
return std::make_unique<TestAssistantWebView>(); return std::make_unique<TestAssistantWebView>();
} }
......
...@@ -21,8 +21,8 @@ class TestAssistantWebViewFactory : public AssistantWebViewFactory { ...@@ -21,8 +21,8 @@ class TestAssistantWebViewFactory : public AssistantWebViewFactory {
~TestAssistantWebViewFactory() override; ~TestAssistantWebViewFactory() override;
// AssistantWebViewFactory: // AssistantWebViewFactory:
std::unique_ptr<AssistantWebView2> Create( std::unique_ptr<AssistantWebView> Create(
const AssistantWebView2::InitParams& params) override; const AssistantWebView::InitParams& params) override;
}; };
} // namespace ash } // namespace ash
......
...@@ -123,7 +123,7 @@ bool AssistantWebContainerView::GoBack() { ...@@ -123,7 +123,7 @@ bool AssistantWebContainerView::GoBack() {
void AssistantWebContainerView::OpenUrl(const GURL& url) { void AssistantWebContainerView::OpenUrl(const GURL& url) {
RemoveContents(); RemoveContents();
AssistantWebView2::InitParams contents_params; AssistantWebView::InitParams contents_params;
contents_params.suppress_navigation = true; contents_params.suppress_navigation = true;
contents_view_ = AssistantWebViewFactory::Get()->Create(contents_params); contents_view_ = AssistantWebViewFactory::Get()->Create(contents_params);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef ASH_ASSISTANT_UI_ASSISTANT_WEB_CONTAINER_VIEW_H_ #ifndef ASH_ASSISTANT_UI_ASSISTANT_WEB_CONTAINER_VIEW_H_
#define ASH_ASSISTANT_UI_ASSISTANT_WEB_CONTAINER_VIEW_H_ #define ASH_ASSISTANT_UI_ASSISTANT_WEB_CONTAINER_VIEW_H_
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "base/component_export.h" #include "base/component_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
...@@ -18,7 +18,7 @@ class AssistantWebViewDelegate; ...@@ -18,7 +18,7 @@ class AssistantWebViewDelegate;
// The container for hosting standalone WebContents in Assistant. // The container for hosting standalone WebContents in Assistant.
class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView
: public views::WidgetDelegateView, : public views::WidgetDelegateView,
public AssistantWebView2::Observer { public AssistantWebView::Observer {
public: public:
AssistantWebContainerView( AssistantWebContainerView(
AssistantViewDelegate* assistant_view_delegate, AssistantViewDelegate* assistant_view_delegate,
...@@ -30,7 +30,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView ...@@ -30,7 +30,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
void ChildPreferredSizeChanged(views::View* child) override; void ChildPreferredSizeChanged(views::View* child) override;
// AssistantWebView2::Observer: // AssistantWebView::Observer:
void DidStopLoading() override; void DidStopLoading() override;
void DidSuppressNavigation(const GURL& url, void DidSuppressNavigation(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
...@@ -52,7 +52,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView ...@@ -52,7 +52,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantWebContainerView
AssistantViewDelegate* const assistant_view_delegate_; AssistantViewDelegate* const assistant_view_delegate_;
AssistantWebViewDelegate* const web_container_view_delegate_; AssistantWebViewDelegate* const web_container_view_delegate_;
std::unique_ptr<AssistantWebView2> contents_view_; std::unique_ptr<AssistantWebView> contents_view_;
DISALLOW_COPY_AND_ASSIGN(AssistantWebContainerView); DISALLOW_COPY_AND_ASSIGN(AssistantWebContainerView);
}; };
......
...@@ -214,8 +214,8 @@ void AssistantCardElementView::InitLayout( ...@@ -214,8 +214,8 @@ void AssistantCardElementView::InitLayout(
GetViewAccessibility().OverrideName(card_element->fallback()); GetViewAccessibility().OverrideName(card_element->fallback());
} }
AssistantWebView2* AssistantCardElementView::contents_view() { AssistantWebView* AssistantCardElementView::contents_view() {
return const_cast<AssistantWebView2*>(card_element_->contents_view()); return const_cast<AssistantWebView*>(card_element_->contents_view());
} }
} // namespace ash } // namespace ash
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <string> #include <string>
#include "ash/assistant/ui/main_stage/assistant_ui_element_view.h" #include "ash/assistant/ui/main_stage/assistant_ui_element_view.h"
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "base/component_export.h" #include "base/component_export.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -21,7 +21,7 @@ class AssistantViewDelegate; ...@@ -21,7 +21,7 @@ class AssistantViewDelegate;
// AssistantCardElement. It is a child view of UiElementContainerView. // AssistantCardElement. It is a child view of UiElementContainerView.
class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView
: public AssistantUiElementView, : public AssistantUiElementView,
public AssistantWebView2::Observer { public AssistantWebView::Observer {
public: public:
AssistantCardElementView(AssistantViewDelegate* delegate, AssistantCardElementView(AssistantViewDelegate* delegate,
const AssistantCardElement* card_element); const AssistantCardElement* card_element);
...@@ -36,7 +36,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView ...@@ -36,7 +36,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView
void OnGestureEvent(ui::GestureEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override;
void ScrollRectToVisible(const gfx::Rect& rect) override; void ScrollRectToVisible(const gfx::Rect& rect) override;
// AssistantWebView2::Observer: // AssistantWebView::Observer:
void DidSuppressNavigation(const GURL& url, void DidSuppressNavigation(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
bool from_user_gesture) override; bool from_user_gesture) override;
...@@ -51,7 +51,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView ...@@ -51,7 +51,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantCardElementView
private: private:
void InitLayout(const AssistantCardElement* card_element); void InitLayout(const AssistantCardElement* card_element);
AssistantWebView2* contents_view(); AssistantWebView* contents_view();
AssistantViewDelegate* const delegate_; AssistantViewDelegate* const delegate_;
const AssistantCardElement* const card_element_; const AssistantCardElement* const card_element_;
......
...@@ -43,7 +43,7 @@ void ProactiveSuggestionsRichView::InitLayout() { ...@@ -43,7 +43,7 @@ void ProactiveSuggestionsRichView::InitLayout() {
GetProactiveSuggestionsRichEntryPointCornerRadius()); GetProactiveSuggestionsRichEntryPointCornerRadius());
// Initialize |contents_view_| params. // Initialize |contents_view_| params.
AssistantWebView2::InitParams params; AssistantWebView::InitParams params;
params.enable_auto_resize = true; params.enable_auto_resize = true;
params.min_size = gfx::Size(1, 1); params.min_size = gfx::Size(1, 1);
params.max_size = gfx::Size(INT_MAX, INT_MAX); params.max_size = gfx::Size(INT_MAX, INT_MAX);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <memory> #include <memory>
#include "ash/assistant/ui/proactive_suggestions_view.h" #include "ash/assistant/ui/proactive_suggestions_view.h"
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "ui/events/event_observer.h" #include "ui/events/event_observer.h"
...@@ -25,13 +25,14 @@ class ViewShadow; ...@@ -25,13 +25,14 @@ class ViewShadow;
class COMPONENT_EXPORT(ASSISTANT_UI) ProactiveSuggestionsRichView class COMPONENT_EXPORT(ASSISTANT_UI) ProactiveSuggestionsRichView
: public ProactiveSuggestionsView, : public ProactiveSuggestionsView,
public ui::EventObserver, public ui::EventObserver,
public AssistantWebView2::Observer { public AssistantWebView::Observer {
public: public:
explicit ProactiveSuggestionsRichView(AssistantViewDelegate* delegate); explicit ProactiveSuggestionsRichView(AssistantViewDelegate* delegate);
explicit ProactiveSuggestionsRichView(ProactiveSuggestionsRichView&) = delete; ~ProactiveSuggestionsRichView() override;
ProactiveSuggestionsRichView(ProactiveSuggestionsRichView&) = delete;
ProactiveSuggestionsRichView& operator=(ProactiveSuggestionsRichView&) = ProactiveSuggestionsRichView& operator=(ProactiveSuggestionsRichView&) =
delete; delete;
~ProactiveSuggestionsRichView() override;
// ProactiveSuggestionsView: // ProactiveSuggestionsView:
const char* GetClassName() const override; const char* GetClassName() const override;
...@@ -49,14 +50,14 @@ class COMPONENT_EXPORT(ASSISTANT_UI) ProactiveSuggestionsRichView ...@@ -49,14 +50,14 @@ class COMPONENT_EXPORT(ASSISTANT_UI) ProactiveSuggestionsRichView
using views::View::OnEvent; // Suppress clang warning. using views::View::OnEvent; // Suppress clang warning.
void OnEvent(const ui::Event& event) override; void OnEvent(const ui::Event& event) override;
// AssistantWebView2::Observer: // AssistantWebView::Observer:
void DidStopLoading() override; void DidStopLoading() override;
void DidSuppressNavigation(const GURL& url, void DidSuppressNavigation(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
bool from_user_gesture) override; bool from_user_gesture) override;
private: private:
std::unique_ptr<AssistantWebView2> contents_view_; std::unique_ptr<AssistantWebView> contents_view_;
std::unique_ptr<views::EventMonitor> event_monitor_; std::unique_ptr<views::EventMonitor> event_monitor_;
std::unique_ptr<ViewShadow> view_shadow_; std::unique_ptr<ViewShadow> view_shadow_;
......
...@@ -69,8 +69,8 @@ component("cpp") { ...@@ -69,8 +69,8 @@ component("cpp") {
"assistant/assistant_state.h", "assistant/assistant_state.h",
"assistant/assistant_state_base.cc", "assistant/assistant_state_base.cc",
"assistant/assistant_state_base.h", "assistant/assistant_state_base.h",
"assistant/assistant_web_view_2.cc", "assistant/assistant_web_view.cc",
"assistant/assistant_web_view_2.h", "assistant/assistant_web_view.h",
"assistant/assistant_web_view_factory.cc", "assistant/assistant_web_view_factory.cc",
"assistant/assistant_web_view_factory.h", "assistant/assistant_web_view_factory.h",
"assistant/conversation_starter.cc", "assistant/conversation_starter.cc",
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
namespace ash { namespace ash {
// AssistantWebView2 ----------------------------------------------------------- // AssistantWebView ------------------------------------------------------------
AssistantWebView2::AssistantWebView2() = default; AssistantWebView::AssistantWebView() = default;
AssistantWebView2::~AssistantWebView2() = default; AssistantWebView::~AssistantWebView() = default;
// AssistantWebView2::InitParams ----------------------------------------------- // AssistantWebView::InitParams ------------------------------------------------
AssistantWebView2::InitParams::InitParams() = default; AssistantWebView::InitParams::InitParams() = default;
AssistantWebView2::InitParams::InitParams(const InitParams& copy) = default; AssistantWebView::InitParams::InitParams(const InitParams& copy) = default;
AssistantWebView2::InitParams::~InitParams() = default; AssistantWebView::InitParams::~InitParams() = default;
} // namespace ash } // namespace ash
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_2_H_ #ifndef ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_H_
#define ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_2_H_ #define ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_H_
#include "ash/public/cpp/ash_public_export.h" #include "ash/public/cpp/ash_public_export.h"
#include "base/observer_list_types.h" #include "base/observer_list_types.h"
...@@ -15,33 +15,31 @@ enum class WindowOpenDisposition; ...@@ -15,33 +15,31 @@ enum class WindowOpenDisposition;
namespace ash { namespace ash {
// TODO(b/146520500): Rename to AssistantWebView after freeing up name which is
// currently in use.
// A view which wraps a views::WebView (and associated WebContents) to work // A view which wraps a views::WebView (and associated WebContents) to work
// around dependency restrictions in Ash. // around dependency restrictions in Ash.
class ASH_PUBLIC_EXPORT AssistantWebView2 : public views::View { class ASH_PUBLIC_EXPORT AssistantWebView : public views::View {
public: public:
// Initialization parameters which dictate how an instance of // Initialization parameters which dictate how an instance of AssistantWebView
// AssistantWebView2 should behave. // should behave.
struct InitParams { struct InitParams {
InitParams(); InitParams();
InitParams(const InitParams& copy); InitParams(const InitParams& copy);
~InitParams(); ~InitParams();
// If enabled, AssistantWebView2 will automatically resize to the size // If enabled, AssistantWebView will automatically resize to the size
// desired by its embedded WebContents. Note that, if specified, the // desired by its embedded WebContents. Note that, if specified, the
// WebContents will be bounded by |min_size| and |max_size|. // WebContents will be bounded by |min_size| and |max_size|.
bool enable_auto_resize = false; bool enable_auto_resize = false;
base::Optional<gfx::Size> min_size = base::nullopt; base::Optional<gfx::Size> min_size = base::nullopt;
base::Optional<gfx::Size> max_size = base::nullopt; base::Optional<gfx::Size> max_size = base::nullopt;
// If enabled, AssistantWebView2 will suppress navigation attempts of its // If enabled, AssistantWebView will suppress navigation attempts of its
// embedded WebContents. When navigation suppression occurs, // embedded WebContents. When navigation suppression occurs,
// Observer::DidSuppressNavigation() will be invoked. // Observer::DidSuppressNavigation() will be invoked.
bool suppress_navigation = false; bool suppress_navigation = false;
}; };
// An observer which receives AssistantWebView2 events. // An observer which receives AssistantWebView events.
class Observer : public base::CheckedObserver { class Observer : public base::CheckedObserver {
public: public:
// Invoked when the embedded WebContents has stopped loading. // Invoked when the embedded WebContents has stopped loading.
...@@ -60,7 +58,7 @@ class ASH_PUBLIC_EXPORT AssistantWebView2 : public views::View { ...@@ -60,7 +58,7 @@ class ASH_PUBLIC_EXPORT AssistantWebView2 : public views::View {
virtual void DidChangeFocusedNode(const gfx::Rect& node_bounds_in_screen) {} virtual void DidChangeFocusedNode(const gfx::Rect& node_bounds_in_screen) {}
}; };
~AssistantWebView2() override; ~AssistantWebView() override;
// Adds/removes the specified |observer|. // Adds/removes the specified |observer|.
virtual void AddObserver(Observer* observer) = 0; virtual void AddObserver(Observer* observer) = 0;
...@@ -78,9 +76,9 @@ class ASH_PUBLIC_EXPORT AssistantWebView2 : public views::View { ...@@ -78,9 +76,9 @@ class ASH_PUBLIC_EXPORT AssistantWebView2 : public views::View {
virtual void Navigate(const GURL& url) = 0; virtual void Navigate(const GURL& url) = 0;
protected: protected:
AssistantWebView2(); AssistantWebView();
}; };
} // namespace ash } // namespace ash
#endif // ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_2_H_ #endif // ASH_PUBLIC_CPP_ASSISTANT_ASSISTANT_WEB_VIEW_H_
...@@ -8,20 +8,20 @@ ...@@ -8,20 +8,20 @@
#include <memory> #include <memory>
#include "ash/public/cpp/ash_public_export.h" #include "ash/public/cpp/ash_public_export.h"
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
namespace ash { namespace ash {
// A factory implemented in Browser which is responsible for creating instances // A factory implemented in Browser which is responsible for creating instances
// of AssistantWebView2 to work around dependency restrictions in Ash. // of AssistantWebView to work around dependency restrictions in Ash.
class ASH_PUBLIC_EXPORT AssistantWebViewFactory { class ASH_PUBLIC_EXPORT AssistantWebViewFactory {
public: public:
// Returns the singleton factory instance. // Returns the singleton factory instance.
static AssistantWebViewFactory* Get(); static AssistantWebViewFactory* Get();
// Creates a new AssistantWebView2 instance with the given |params|. // Creates a new AssistantWebView instance with the given |params|.
virtual std::unique_ptr<AssistantWebView2> Create( virtual std::unique_ptr<AssistantWebView> Create(
const AssistantWebView2::InitParams& params) = 0; const AssistantWebView::InitParams& params) = 0;
protected: protected:
AssistantWebViewFactory(); AssistantWebViewFactory();
......
...@@ -12,7 +12,7 @@ AssistantWebViewFactoryImpl::AssistantWebViewFactoryImpl(Profile* profile) ...@@ -12,7 +12,7 @@ AssistantWebViewFactoryImpl::AssistantWebViewFactoryImpl(Profile* profile)
AssistantWebViewFactoryImpl::~AssistantWebViewFactoryImpl() = default; AssistantWebViewFactoryImpl::~AssistantWebViewFactoryImpl() = default;
std::unique_ptr<ash::AssistantWebView2> AssistantWebViewFactoryImpl::Create( std::unique_ptr<ash::AssistantWebView> AssistantWebViewFactoryImpl::Create(
const ash::AssistantWebView2::InitParams& params) { const ash::AssistantWebView::InitParams& params) {
return std::make_unique<AssistantWebViewImpl>(profile_, params); return std::make_unique<AssistantWebViewImpl>(profile_, params);
} }
...@@ -14,14 +14,14 @@ class Profile; ...@@ -14,14 +14,14 @@ class Profile;
class AssistantWebViewFactoryImpl : public ash::AssistantWebViewFactory { class AssistantWebViewFactoryImpl : public ash::AssistantWebViewFactory {
public: public:
explicit AssistantWebViewFactoryImpl(Profile* profile); explicit AssistantWebViewFactoryImpl(Profile* profile);
AssistantWebViewFactoryImpl(AssistantWebViewFactoryImpl& copy) = delete;
AssistantWebViewFactoryImpl& operator=(AssistantWebViewFactoryImpl& assign) =
delete;
~AssistantWebViewFactoryImpl() override; ~AssistantWebViewFactoryImpl() override;
AssistantWebViewFactoryImpl(AssistantWebViewFactoryImpl&) = delete;
AssistantWebViewFactoryImpl& operator=(AssistantWebViewFactoryImpl&) = delete;
// ash::AssistantWebViewFactory: // ash::AssistantWebViewFactory:
std::unique_ptr<ash::AssistantWebView2> Create( std::unique_ptr<ash::AssistantWebView> Create(
const ash::AssistantWebView2::InitParams& params) override; const ash::AssistantWebView::InitParams& params) override;
private: private:
Profile* const profile_; Profile* const profile_;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_WEB_VIEW_IMPL_H_ #ifndef CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_WEB_VIEW_IMPL_H_
#define CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_WEB_VIEW_IMPL_H_ #define CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_WEB_VIEW_IMPL_H_
#include "ash/public/cpp/assistant/assistant_web_view_2.h" #include "ash/public/cpp/assistant/assistant_web_view.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
...@@ -20,18 +20,19 @@ namespace views { ...@@ -20,18 +20,19 @@ namespace views {
class WebView; class WebView;
} // namespace views } // namespace views
// Implements AssistantWebView2 used by Ash to work around dependency // Implements AssistantWebView used by Ash to work around dependency
// restrictions. // restrictions.
class AssistantWebViewImpl : public ash::AssistantWebView2, class AssistantWebViewImpl : public ash::AssistantWebView,
public content::WebContentsDelegate, public content::WebContentsDelegate,
public content::WebContentsObserver { public content::WebContentsObserver {
public: public:
explicit AssistantWebViewImpl(Profile* profile, const InitParams& params); explicit AssistantWebViewImpl(Profile* profile, const InitParams& params);
AssistantWebViewImpl(AssistantWebViewImpl& copy) = delete;
AssistantWebViewImpl& operator=(AssistantWebViewImpl& assign) = delete;
~AssistantWebViewImpl() override; ~AssistantWebViewImpl() override;
// ash::AssistantWebView2: AssistantWebViewImpl(AssistantWebViewImpl&) = delete;
AssistantWebViewImpl& operator=(AssistantWebViewImpl&) = delete;
// ash::AssistantWebView:
const char* GetClassName() const override; const char* GetClassName() const override;
gfx::NativeView GetNativeView() override; gfx::NativeView GetNativeView() override;
void ChildPreferredSizeChanged(views::View* child) override; void ChildPreferredSizeChanged(views::View* child) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment