diff options
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 23 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 2 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 13 | ||||
-rw-r--r-- | chrome/browser/browser.h | 1 | ||||
-rw-r--r-- | chrome/browser/browser_init.cc | 6 | ||||
-rw-r--r-- | chrome/browser/browser_uitest.cc | 26 | ||||
-rw-r--r-- | chrome/browser/browser_window.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.h | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.mm | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 16 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 11 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 8 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 10 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 20 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 7 | ||||
-rw-r--r-- | chrome/test/test_browser_window.h | 1 |
19 files changed, 154 insertions, 7 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 537cc6d..8df4ae4 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -321,6 +321,9 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(AutomationMsg_TabIndex, GetTabIndex) IPC_MESSAGE_HANDLER(AutomationMsg_TabURL, GetTabURL) IPC_MESSAGE_HANDLER(AutomationMsg_ShelfVisibility, GetShelfVisibility) + IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreen, IsFullscreen) + IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreenBubbleVisible, + GetFullscreenBubbleVisibility) IPC_MESSAGE_HANDLER(AutomationMsg_HandleUnused, HandleUnused) IPC_MESSAGE_HANDLER(AutomationMsg_ApplyAccelerator, ApplyAccelerator) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_DomOperation, @@ -1110,6 +1113,26 @@ void AutomationProvider::SetShelfVisibility(int handle, bool visible) { } } +void AutomationProvider::IsFullscreen(int handle, bool* visible) { + *visible = false; + + if (browser_tracker_->ContainsHandle(handle)) { + Browser* browser = browser_tracker_->GetResource(handle); + if (browser) + *visible = browser->window()->IsFullscreen(); + } +} + +void AutomationProvider::GetFullscreenBubbleVisibility(int handle, + bool* visible) { + *visible = false; + + if (browser_tracker_->ContainsHandle(handle)) { + Browser* browser = browser_tracker_->GetResource(handle); + if (browser) + *visible = browser->window()->IsFullscreenBubbleVisible(); + } +} void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) { *count = -1; // -1 is the error code diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 82a2d72..66e7de8 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -226,6 +226,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void SetFilteredInet(const IPC::Message& message, bool enabled); void GetFilteredInetHitCount(int* hit_count); void SetProxyConfig(const std::string& new_proxy_config); + void IsFullscreen(int handle, bool* is_fullscreen); + void GetFullscreenBubbleVisibility(int handle, bool* is_visible); #if defined(OS_WIN) void ScheduleMouseEvent(views::View* view, diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 30a7a01..27e1423 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -921,6 +921,14 @@ void Browser::ConvertPopupToTabbedBrowser() { } void Browser::ToggleFullscreenMode() { +#if !defined(OS_MACOSX) + // In kiosk mode, we always want to be fullscreen. When the browser first + // starts we're not yet fullscreen, so let the initial toggle go through. + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) && + window_->IsFullscreen()) + return; +#endif + UserMetrics::RecordAction(L"ToggleFullscreen", profile_); window_->SetFullscreen(!window_->IsFullscreen()); // On Linux, setting fullscreen mode is an async call to the X server, which @@ -2644,6 +2652,11 @@ void Browser::RemoveScheduledUpdatesFor(TabContents* contents) { // Browser, Getters for UI (private): StatusBubble* Browser::GetStatusBubble() { +#if !defined(OS_MACOSX) + // In kiosk mode, we want to always hide the status bubble. + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) + return NULL; +#endif return window_ ? window_->GetStatusBubble() : NULL; } diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 19ee871..a587aff 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -347,6 +347,7 @@ class Browser : public TabStripModelDelegate, void RestoreTab(); void WriteCurrentURLToClipboard(); void ConvertPopupToTabbedBrowser(); + // In kiosk mode, the first toggle is valid, the rest is discarded. void ToggleFullscreenMode(); void Exit(); #if defined(TOOLKIT_VIEWS) diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index a0ee959..5a08089 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -559,6 +559,12 @@ Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser( if (!browser || browser->type() != Browser::TYPE_NORMAL) browser = Browser::Create(profile_); +#if !defined(OS_MACOSX) + // In kiosk mode, we want to always be fullscreen, so switch to that now. + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) + browser->ToggleFullscreenMode(); +#endif + for (size_t i = 0; i < urls.size(); ++i) { // We skip URLs that we'd have to launch an external protocol handler for. // This avoids us getting into an infinite loop asking ourselves to open diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 0fd6352..27f3167 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -288,4 +288,30 @@ TEST_F(SecurityTest, DisallowFileUrlUniversalAccessTest) { ASSERT_STREQ("Disallowed", value.c_str()); } +#if !defined(OS_MACOSX) +class KioskModeTest : public UITest { + public: + KioskModeTest() { + launch_arguments_.AppendSwitch(switches::kKioskMode); + } +}; + +TEST_F(KioskModeTest, EnableKioskModeTest) { + // Load a dummy url. + FilePath test_file(test_data_directory_); + test_file = test_file.AppendASCII("title1.html"); + + // Verify that the window is present. + scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser.get()); + + // Check if browser is in fullscreen mode. + bool is_visible; + ASSERT_TRUE(browser->IsFullscreen(&is_visible)); + EXPECT_TRUE(is_visible); + ASSERT_TRUE(browser->IsFullscreenBubbleVisible(&is_visible)); + EXPECT_FALSE(is_visible); +} +#endif + } // namespace diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 2ba45da..de9823e 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -118,6 +118,9 @@ class BrowserWindow { virtual void SetFullscreen(bool fullscreen) = 0; virtual bool IsFullscreen() const = 0; + // Returns true if the fullscreen bubble is visible. + virtual bool IsFullscreenBubbleVisible() const = 0; + // Returns the location bar. virtual LocationBar* GetLocationBar() const = 0; diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index 74220e5..b5ef31f 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -49,6 +49,7 @@ class BrowserWindowCocoa : public BrowserWindow, virtual bool IsMaximized() const; virtual void SetFullscreen(bool fullscreen); virtual bool IsFullscreen() const; + virtual bool IsFullscreenBubbleVisible() const; virtual LocationBar* GetLocationBar() const; virtual void SetFocusToLocationBar(); virtual void UpdateStopGoState(bool is_loading, bool force); diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index 10f206f..8e5b50b 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -165,6 +165,10 @@ bool BrowserWindowCocoa::IsFullscreen() const { return !![controller_ isFullscreen]; } +bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { + return false; +} + gfx::Rect BrowserWindowCocoa::GetRootWindowResizerRect() const { NSRect tabRect = [controller_ selectedTabGrowBoxRect]; return gfx::Rect(NSRectToCGRect(tabRect)); diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 63fe880..87bf9c2 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1018,6 +1018,11 @@ bool BrowserWindowGtk::IsFullscreen() const { return (state_ & GDK_WINDOW_STATE_FULLSCREEN); } +bool BrowserWindowGtk::IsFullscreenBubbleVisible() const { + // There is no fullscreen bubble for Linux. + return false; +} + LocationBar* BrowserWindowGtk::GetLocationBar() const { return toolbar_->GetLocationBar(); } diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index cb272ad..6d79a9a 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -78,6 +78,7 @@ class BrowserWindowGtk : public BrowserWindow, virtual bool IsMaximized() const; virtual void SetFullscreen(bool fullscreen); virtual bool IsFullscreen() const; + virtual bool IsFullscreenBubbleVisible() const; virtual LocationBar* GetLocationBar() const; virtual void SetFocusToLocationBar(); virtual void UpdateStopGoState(bool is_loading, bool force); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index ac22274..23d7bd3 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -893,8 +893,16 @@ void BrowserView::SetFullscreen(bool fullscreen) { frame_->GetWindow()->SetFullscreen(fullscreen); if (fullscreen) { - fullscreen_bubble_.reset(new FullscreenExitBubble(GetWidget(), - browser_.get())); +#if !defined(OS_MACOSX) + bool is_kosk = + CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); +#else + bool is_kiosk = false; +#endif + if (!is_kosk) { + fullscreen_bubble_.reset(new FullscreenExitBubble(GetWidget(), + browser_.get())); + } } else { #if defined(OS_WIN) // Show the edit again since we're no longer in fullscreen mode. @@ -916,6 +924,10 @@ bool BrowserView::IsFullscreen() const { return frame_->GetWindow()->IsFullscreen(); } +bool BrowserView::IsFullscreenBubbleVisible() const { + return fullscreen_bubble_.get() ? true : false; +} + LocationBar* BrowserView::GetLocationBar() const { return toolbar_->location_bar(); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index d9baada..cf4ca78 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -204,6 +204,9 @@ class BrowserView : public BrowserWindow, // in the window caption area of the browser window. bool IsPositionInWindowCaption(const gfx::Point& point); + // Returns whether the fullscreen bubble is visible or not. + bool IsFullscreenBubbleVisible() const; + // Overridden from BrowserWindow: virtual void Show(); virtual void SetBounds(const gfx::Rect& bounds); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index ef26499..e91f5d1 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -203,6 +203,9 @@ const char kEnableMonitorProfile[] = "enable-monitor-profile"; // Enable Native Web Worker support const char kEnableNativeWebWorkers[] = "enable-native-web-workers"; +// Enable AutoFill++. +const char kEnableNewAutoFill[] = "enable-new-autofill"; + // Enable remote web font support. SVG font should always work whether // this option is specified or not. const char kEnableRemoteFonts[] = "enable-remote-fonts"; @@ -304,6 +307,11 @@ const char kInternalNaCl[] = "internal-nacl"; // Specifies the flags passed to JS engine const char kJavaScriptFlags[] = "js-flags"; +#if !defined(OS_MACOSX) +// Enable Kiosk mode. +const char kKioskMode[] = "kiosk"; +#endif + // Load an extension from the specified directory. const char kLoadExtension[] = "load-extension"; @@ -692,7 +700,4 @@ const char kGearsPluginPathOverride[] = "gears-plugin-path"; // appropriate ifdef at the bottom. The order should match the header. // ----------------------------------------------------------------------------- -// Enable AutoFill++. -const char kEnableNewAutoFill[] = "enable-new-autofill"; - } // namespace switches diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 4174564..fea5e43 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -73,6 +73,7 @@ extern const char kDisableLocalStorage[]; extern const char kEnableLogging[]; extern const char kEnableMonitorProfile[]; extern const char kEnableNativeWebWorkers[]; +extern const char kEnableNewAutoFill[]; extern const char kEnableRemoteFonts[]; extern const char kEnableRendererAccessibility[]; extern const char kEnableSeccompSandbox[]; @@ -96,6 +97,11 @@ extern const char kInProcessPlugins[]; extern const char kIncognito[]; extern const char kInternalNaCl[]; extern const char kJavaScriptFlags[]; + +#if !defined(OS_MACOSX) +extern const char kKioskMode[]; +#endif + extern const char kLoadExtension[]; extern const char kLoadPlugin[]; extern const char kLogFilterPrefix[]; @@ -206,8 +212,6 @@ extern const char kGearsPluginPathOverride[]; // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in // alphabetical order, or in one of the ifdefs (also in order in each section). -extern const char kEnableNewAutoFill[]; - } // namespace switches #endif // CHROME_COMMON_CHROME_SWITCHES_H_ diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 0616aea..d2f7458 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -1016,6 +1016,16 @@ IPC_BEGIN_MESSAGES(Automation) IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetFilteredInetHitCount, int /* hit_count */) + // Is the browser in fullscreen mode? + IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreen, + int /* browser_handle */, + bool /* is_fullscreen */) + + // Is the fullscreen bubble visible? + IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreenBubbleVisible, + int /* browser_handle */, + bool /* is_visible */) + #if defined(OS_LINUX) || defined(OS_MACOSX) // See previous definition of this message for explanation of why it is // defined twice. diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index fcbd4af..7da15e2 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -457,3 +457,23 @@ scoped_refptr<AutocompleteEditProxy> BrowserProxy::GetAutocompleteEdit() { result.swap(&p); return result; } + +bool BrowserProxy::IsFullscreen(bool* is_fullscreen) { + DCHECK(is_fullscreen); + + if (!is_valid()) + return false; + + return sender_->Send(new AutomationMsg_IsFullscreen(0, handle_, + is_fullscreen)); +} + +bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) { + DCHECK(is_visible); + + if (!is_valid()) + return false; + + return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(0, handle_, + is_visible)); +} diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index f3641e3..88a1d58 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -204,6 +204,13 @@ class BrowserProxy : public AutomationResourceProxy { // mahine). bool TerminateSession(); + // Sets |is_fullscreen| to whether the browser is currently in fullscreen + // mode. + bool IsFullscreen(bool* is_fullscreen); + + // Sets |is_visible| to whether the browser's fullscreen bubble is visible. + bool IsFullscreenBubbleVisible(bool* is_visible); + protected: virtual ~BrowserProxy() {} private: diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index 22e36c1..e4cb589 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -39,6 +39,7 @@ class TestBrowserWindow : public BrowserWindow { virtual bool IsMaximized() const { return false; } virtual void SetFullscreen(bool fullscreen) {} virtual bool IsFullscreen() const { return false; } + virtual bool IsFullscreenBubbleVisible() const { return false; } virtual LocationBar* GetLocationBar() const { return const_cast<TestLocationBar*>(&location_bar_); } |