Commit b4ecdad7 authored by Collin Baker's avatar Collin Baker Committed by Commit Bot

Move FeaturePromoController and add getter to BrowserWindow

Bug: 1106523
Change-Id: I36cbf3d0de3c5e4a229874f2d505016772fb6d44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432384Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811464}
parent 008482bb
...@@ -1010,6 +1010,8 @@ static_library("ui") { ...@@ -1010,6 +1010,8 @@ static_library("ui") {
"hung_renderer/hung_renderer_core.h", "hung_renderer/hung_renderer_core.h",
"in_product_help/active_tab_tracker.cc", "in_product_help/active_tab_tracker.cc",
"in_product_help/active_tab_tracker.h", "in_product_help/active_tab_tracker.h",
"in_product_help/feature_promo_controller.cc",
"in_product_help/feature_promo_controller.h",
"in_product_help/feature_promo_snooze_service.cc", "in_product_help/feature_promo_snooze_service.cc",
"in_product_help/feature_promo_snooze_service.h", "in_product_help/feature_promo_snooze_service.h",
"in_product_help/reopen_tab_in_product_help.cc", "in_product_help/reopen_tab_in_product_help.cc",
...@@ -3568,8 +3570,6 @@ static_library("ui") { ...@@ -3568,8 +3570,6 @@ static_library("ui") {
"views/in_product_help/feature_promo_bubble_view.h", "views/in_product_help/feature_promo_bubble_view.h",
"views/in_product_help/feature_promo_colors.cc", "views/in_product_help/feature_promo_colors.cc",
"views/in_product_help/feature_promo_colors.h", "views/in_product_help/feature_promo_colors.h",
"views/in_product_help/feature_promo_controller.cc",
"views/in_product_help/feature_promo_controller.h",
"views/in_product_help/feature_promo_controller_views.cc", "views/in_product_help/feature_promo_controller_views.cc",
"views/in_product_help/feature_promo_controller_views.h", "views/in_product_help/feature_promo_controller_views.h",
"views/in_product_help/feature_promo_registry.cc", "views/in_product_help/feature_promo_registry.cc",
......
...@@ -40,6 +40,7 @@ class SharingDialog; ...@@ -40,6 +40,7 @@ class SharingDialog;
class DownloadShelf; class DownloadShelf;
class ExclusiveAccessContext; class ExclusiveAccessContext;
class ExtensionsContainer; class ExtensionsContainer;
class FeaturePromoController;
class FindBar; class FindBar;
class GURL; class GURL;
class LocationBar; class LocationBar;
...@@ -503,6 +504,10 @@ class BrowserWindow : public ui::BaseWindow { ...@@ -503,6 +504,10 @@ class BrowserWindow : public ui::BaseWindow {
// Create and open the tab search bubble. // Create and open the tab search bubble.
virtual void CreateTabSearchBubble() = 0; virtual void CreateTabSearchBubble() = 0;
// Gets the windows's FeaturePromoController which manages display of
// in-product help.
virtual FeaturePromoController* GetFeaturePromoController() = 0;
protected: protected:
friend class BrowserCloseManager; friend class BrowserCloseManager;
friend class BrowserView; friend class BrowserView;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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 "chrome/browser/ui/views/in_product_help/feature_promo_controller.h" #include "chrome/browser/ui/in_product_help/feature_promo_controller.h"
FeaturePromoController::PromoHandle::PromoHandle( FeaturePromoController::PromoHandle::PromoHandle(
base::WeakPtr<FeaturePromoController> controller) base::WeakPtr<FeaturePromoController> controller)
......
...@@ -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 CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_ #ifndef CHROME_BROWSER_UI_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_
#define CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_ #define CHROME_BROWSER_UI_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -75,4 +75,4 @@ class FeaturePromoController { ...@@ -75,4 +75,4 @@ class FeaturePromoController {
virtual void FinishContinuedPromo() = 0; virtual void FinishContinuedPromo() = 0;
}; };
#endif // CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_ #endif // CHROME_BROWSER_UI_IN_PRODUCT_HELP_FEATURE_PROMO_CONTROLLER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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 "chrome/browser/ui/views/in_product_help/mock_feature_promo_controller.h" #include "chrome/browser/ui/in_product_help/mock_feature_promo_controller.h"
MockFeaturePromoController::MockFeaturePromoController() = default; MockFeaturePromoController::MockFeaturePromoController() = default;
MockFeaturePromoController::~MockFeaturePromoController() = default; MockFeaturePromoController::~MockFeaturePromoController() = default;
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
// 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 CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_ #ifndef CHROME_BROWSER_UI_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_
#define CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_ #define CHROME_BROWSER_UI_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_
#include "base/feature_list.h" #include "base/feature_list.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_params.h" #include "chrome/browser/ui/in_product_help/feature_promo_controller.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_controller.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
class MockFeaturePromoController : public FeaturePromoController { class MockFeaturePromoController : public FeaturePromoController {
...@@ -26,4 +25,4 @@ class MockFeaturePromoController : public FeaturePromoController { ...@@ -26,4 +25,4 @@ class MockFeaturePromoController : public FeaturePromoController {
MOCK_METHOD(void, FinishContinuedPromo, (), (override)); MOCK_METHOD(void, FinishContinuedPromo, (), (override));
}; };
#endif // CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_ #endif // CHROME_BROWSER_UI_IN_PRODUCT_HELP_MOCK_FEATURE_PROMO_CONTROLLER_H_
...@@ -3455,6 +3455,10 @@ void BrowserView::ShowInProductHelpPromo(InProductHelpFeature iph_feature) { ...@@ -3455,6 +3455,10 @@ void BrowserView::ShowInProductHelpPromo(InProductHelpFeature iph_feature) {
} }
} }
FeaturePromoController* BrowserView::GetFeaturePromoController() {
return feature_promo_controller_.get();
}
bool BrowserView::DoCutCopyPasteForWebContents( bool BrowserView::DoCutCopyPasteForWebContents(
WebContents* contents, WebContents* contents,
void (WebContents::*method)()) { void (WebContents::*method)()) {
......
...@@ -487,6 +487,7 @@ class BrowserView : public BrowserWindow, ...@@ -487,6 +487,7 @@ class BrowserView : public BrowserWindow,
LocationBarView* GetLocationBarView() const; LocationBarView* GetLocationBarView() const;
void ShowInProductHelpPromo(InProductHelpFeature iph_feature) override; void ShowInProductHelpPromo(InProductHelpFeature iph_feature) override;
FeaturePromoController* GetFeaturePromoController() override;
// TabStripModelObserver: // TabStripModelObserver:
void OnTabStripModelChanged( void OnTabStripModelChanged(
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_controller.h" #include "chrome/browser/ui/in_product_help/feature_promo_controller.h"
#include "ui/views/view_tracker.h" #include "ui/views/view_tracker.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
......
...@@ -401,8 +401,6 @@ static_library("test_support") { ...@@ -401,8 +401,6 @@ static_library("test_support") {
"../browser/autofill/autofill_uitest_util.h", "../browser/autofill/autofill_uitest_util.h",
"../browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc", "../browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc",
"../browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h", "../browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h",
"../browser/ui/views/in_product_help/mock_feature_promo_controller.cc",
"../browser/ui/views/in_product_help/mock_feature_promo_controller.h",
"../browser/ui/views/media_router/app_menu_test_api.h", "../browser/ui/views/media_router/app_menu_test_api.h",
"../browser/ui/views/media_router/app_menu_test_api_views.cc", "../browser/ui/views/media_router/app_menu_test_api_views.cc",
"../browser/ui/views/web_apps/web_app_frame_toolbar_test_helper.cc", "../browser/ui/views/web_apps/web_app_frame_toolbar_test_helper.cc",
...@@ -1383,6 +1381,8 @@ if (!is_android) { ...@@ -1383,6 +1381,8 @@ if (!is_android) {
"../browser/ui/find_bar/find_bar_platform_helper_mac_browsertest.mm", "../browser/ui/find_bar/find_bar_platform_helper_mac_browsertest.mm",
"../browser/ui/hats/hats_service_browsertest.cc", "../browser/ui/hats/hats_service_browsertest.cc",
"../browser/ui/hats/hats_survey_status_checker_browsertest.cc", "../browser/ui/hats/hats_survey_status_checker_browsertest.cc",
"../browser/ui/in_product_help/mock_feature_promo_controller.cc",
"../browser/ui/in_product_help/mock_feature_promo_controller.h",
"../browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc", "../browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc",
"../browser/ui/login/login_handler_browsertest.cc", "../browser/ui/login/login_handler_browsertest.cc",
"../browser/ui/managed_ui_browsertest.cc", "../browser/ui/managed_ui_browsertest.cc",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/find_bar/find_bar.h" #include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/in_product_help/feature_promo_controller.h"
#include "content/public/browser/keyboard_event_processing_result.h" #include "content/public/browser/keyboard_event_processing_result.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -266,6 +267,15 @@ void TestBrowserWindow::SetCloseCallback(base::OnceClosure close_callback) { ...@@ -266,6 +267,15 @@ void TestBrowserWindow::SetCloseCallback(base::OnceClosure close_callback) {
close_callback_ = std::move(close_callback); close_callback_ = std::move(close_callback);
} }
FeaturePromoController* TestBrowserWindow::GetFeaturePromoController() {
return feature_promo_controller_.get();
}
void TestBrowserWindow::SetFeaturePromoController(
std::unique_ptr<FeaturePromoController> feature_promo_controller) {
feature_promo_controller_ = std::move(feature_promo_controller);
}
// TestBrowserWindowOwner ----------------------------------------------------- // TestBrowserWindowOwner -----------------------------------------------------
TestBrowserWindowOwner::TestBrowserWindowOwner(TestBrowserWindow* window) TestBrowserWindowOwner::TestBrowserWindowOwner(TestBrowserWindow* window)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "chrome/browser/apps/intent_helper/apps_navigation_types.h" #include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
class FeaturePromoController;
class LocationBarTesting; class LocationBarTesting;
class OmniboxView; class OmniboxView;
...@@ -201,6 +202,13 @@ class TestBrowserWindow : public BrowserWindow { ...@@ -201,6 +202,13 @@ class TestBrowserWindow : public BrowserWindow {
void CreateTabSearchBubble() override {} void CreateTabSearchBubble() override {}
FeaturePromoController* GetFeaturePromoController() override;
// Sets the controller returned by GetFeaturePromoController().
// Deletes the existing one, if any.
void SetFeaturePromoController(
std::unique_ptr<FeaturePromoController> feature_promo_controller);
protected: protected:
void DestroyBrowser() override {} void DestroyBrowser() override {}
...@@ -235,6 +243,8 @@ class TestBrowserWindow : public BrowserWindow { ...@@ -235,6 +243,8 @@ class TestBrowserWindow : public BrowserWindow {
TestLocationBar location_bar_; TestLocationBar location_bar_;
gfx::NativeWindow native_window_ = nullptr; gfx::NativeWindow native_window_ = nullptr;
std::unique_ptr<FeaturePromoController> feature_promo_controller_;
base::OnceClosure close_callback_; base::OnceClosure close_callback_;
DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow);
......
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