Fix vectorized icon for PPAPI broker website setting icon
[chromium-blink-merge.git] / chrome / test / base / test_browser_window.h
blob39d8da2f12c8c08b2bc848b894e576f515de1dd4
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
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_
6 #define CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "build/build_config.h"
11 #include "chrome/browser/download/test_download_shelf.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/location_bar/location_bar.h"
16 class LocationBarTesting;
17 class OmniboxView;
19 namespace extensions {
20 class Extension;
23 // An implementation of BrowserWindow used for testing. TestBrowserWindow only
24 // contains a valid LocationBar, all other getters return NULL.
25 // See BrowserWithTestWindowTest for an example of using this class.
26 class TestBrowserWindow : public BrowserWindow {
27 public:
28 TestBrowserWindow();
29 ~TestBrowserWindow() override;
31 // BrowserWindow:
32 void Show() override {}
33 void ShowInactive() override {}
34 void Hide() override {}
35 void SetBounds(const gfx::Rect& bounds) override {}
36 void Close() override {}
37 void Activate() override {}
38 void Deactivate() override {}
39 bool IsActive() const override;
40 void FlashFrame(bool flash) override {}
41 bool IsAlwaysOnTop() const override;
42 void SetAlwaysOnTop(bool always_on_top) override {}
43 gfx::NativeWindow GetNativeWindow() const override;
44 StatusBubble* GetStatusBubble() override;
45 void UpdateTitleBar() override {}
46 void BookmarkBarStateChanged(
47 BookmarkBar::AnimateChangeType change_type) override {}
48 void UpdateDevTools() override {}
49 void UpdateLoadingAnimations(bool should_animate) override {}
50 void SetStarredState(bool is_starred) override {}
51 void SetTranslateIconToggled(bool is_lit) override {}
52 void OnActiveTabChanged(content::WebContents* old_contents,
53 content::WebContents* new_contents,
54 int index,
55 int reason) override {}
56 void ZoomChangedForActiveTab(bool can_show_bubble) override {}
57 gfx::Rect GetRestoredBounds() const override;
58 ui::WindowShowState GetRestoredState() const override;
59 gfx::Rect GetBounds() const override;
60 bool IsMaximized() const override;
61 bool IsMinimized() const override;
62 void Maximize() override {}
63 void Minimize() override {}
64 void Restore() override {}
65 void EnterFullscreen(const GURL& url,
66 ExclusiveAccessBubbleType type,
67 bool with_toolbar) override {}
68 void ExitFullscreen() override {}
69 void UpdateExclusiveAccessExitBubbleContent(
70 const GURL& url,
71 ExclusiveAccessBubbleType bubble_type) override {}
72 bool ShouldHideUIForFullscreen() const override;
73 bool IsFullscreen() const override;
74 bool IsFullscreenBubbleVisible() const override;
75 bool SupportsFullscreenWithToolbar() const override;
76 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
77 bool IsFullscreenWithToolbar() const override;
78 #if defined(OS_WIN)
79 void SetMetroSnapMode(bool enable) override {}
80 bool IsInMetroSnapMode() const override;
81 #endif
82 LocationBar* GetLocationBar() const override;
83 void SetFocusToLocationBar(bool select_all) override {}
84 void UpdateReloadStopState(bool is_loading, bool force) override {}
85 void UpdateToolbar(content::WebContents* contents) override {}
86 void ResetToolbarTabState(content::WebContents* contents) override {}
87 void FocusToolbar() override {}
88 ToolbarActionsBar* GetToolbarActionsBar() override;
89 void ToolbarSizeChanged(bool is_animating) override {}
90 void FocusAppMenu() override {}
91 void FocusBookmarksToolbar() override {}
92 void FocusInfobars() override {}
93 void RotatePaneFocus(bool forwards) override {}
94 void ShowAppMenu() override {}
95 bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event,
96 bool* is_keyboard_shortcut) override;
97 void HandleKeyboardEvent(
98 const content::NativeWebKeyboardEvent& event) override {}
100 bool IsBookmarkBarVisible() const override;
101 bool IsBookmarkBarAnimating() const override;
102 bool IsTabStripEditable() const override;
103 bool IsToolbarVisible() const override;
104 gfx::Rect GetRootWindowResizerRect() const override;
105 void ConfirmAddSearchProvider(TemplateURL* template_url,
106 Profile* profile) override {}
107 void ShowUpdateChromeDialog() override {}
108 void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override {}
109 void ShowBookmarkAppBubble(
110 const WebApplicationInfo& web_app_info,
111 const ShowBookmarkAppBubbleCallback& callback) override {}
112 void ShowTranslateBubble(content::WebContents* contents,
113 translate::TranslateStep step,
114 translate::TranslateErrors::Type error_type,
115 bool is_user_gesture) override {}
116 bool ShowSessionCrashedBubble() override;
117 bool IsProfileResetBubbleSupported() const override;
118 GlobalErrorBubbleViewBase* ShowProfileResetBubble(
119 const base::WeakPtr<ProfileResetGlobalError>& global_error) override;
120 #if defined(ENABLE_ONE_CLICK_SIGNIN)
121 void ShowOneClickSigninBubble(
122 OneClickSigninBubbleType type,
123 const base::string16& email,
124 const base::string16& error_message,
125 const StartSyncCallback& start_sync_callback) override {}
126 #endif
127 bool IsDownloadShelfVisible() const override;
128 DownloadShelf* GetDownloadShelf() override;
129 void ConfirmBrowserCloseWithPendingDownloads(
130 int download_count,
131 Browser::DownloadClosePreventionType dialog_type,
132 bool app_modal,
133 const base::Callback<void(bool)>& callback) override {}
134 void UserChangedTheme() override {}
135 void ShowWebsiteSettings(Profile* profile,
136 content::WebContents* web_contents,
137 const GURL& url,
138 const content::SSLStatus& ssl) override {}
139 void CutCopyPaste(int command_id) override {}
140 WindowOpenDisposition GetDispositionForPopupBounds(
141 const gfx::Rect& bounds) override;
142 FindBar* CreateFindBar() override;
143 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
144 override;
145 void ShowAvatarBubbleFromAvatarButton(
146 AvatarBubbleMode mode,
147 const signin::ManageAccountsParams& manage_accounts_params) override {}
148 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override;
149 void ExecuteExtensionCommand(const extensions::Extension* extension,
150 const extensions::Command& command) override;
151 ExclusiveAccessContext* GetExclusiveAccessContext() override;
153 protected:
154 void DestroyBrowser() override {}
156 private:
157 class TestLocationBar : public LocationBar {
158 public:
159 TestLocationBar() : LocationBar(NULL) {}
160 ~TestLocationBar() override {}
162 // LocationBar:
163 void ShowFirstRunBubble() override {}
164 GURL GetDestinationURL() const override;
165 WindowOpenDisposition GetWindowOpenDisposition() const override;
166 ui::PageTransition GetPageTransition() const override;
167 void AcceptInput() override {}
168 void FocusLocation(bool select_all) override {}
169 void FocusSearch() override {}
170 void UpdateContentSettingsIcons() override {}
171 void UpdateManagePasswordsIconAndBubble() override {}
172 void UpdatePageActions() override {}
173 void UpdateBookmarkStarVisibility() override {}
174 void UpdateLocationBarVisibility(bool visible, bool animate) override {}
175 bool ShowPageActionPopup(const extensions::Extension* extension,
176 bool grant_active_tab) override;
177 void UpdateOpenPDFInReaderPrompt() override {}
178 void SaveStateToContents(content::WebContents* contents) override {}
179 void Revert() override {}
180 const OmniboxView* GetOmniboxView() const override;
181 OmniboxView* GetOmniboxView() override;
182 LocationBarTesting* GetLocationBarForTesting() override;
184 private:
185 DISALLOW_COPY_AND_ASSIGN(TestLocationBar);
188 TestDownloadShelf download_shelf_;
189 TestLocationBar location_bar_;
191 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow);
194 // Handles destroying a TestBrowserWindow when the Browser it is attached to is
195 // destroyed.
196 class TestBrowserWindowOwner : public chrome::BrowserListObserver {
197 public:
198 explicit TestBrowserWindowOwner(TestBrowserWindow* window);
199 ~TestBrowserWindowOwner() override;
201 private:
202 // Overridden from BrowserListObserver:
203 void OnBrowserRemoved(Browser* browser) override;
204 scoped_ptr<TestBrowserWindow> window_;
206 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner);
209 namespace chrome {
211 // Helper that handle the lifetime of TestBrowserWindow instances.
212 scoped_ptr<Browser> CreateBrowserWithTestWindowForParams(
213 Browser::CreateParams* params);
215 } // namespace chrome
217 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_