Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7731)

Unified Diff: chrome/browser/chromeos/login/webui_login_view.h

Issue 6973029: Integrate WebUI Login with cros. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Implemented login screen using widget Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/webui_login_view.h
diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..d22e6363efaf5b5ef5f9799d1154ea22cb1fa52f
--- /dev/null
+++ b/chrome/browser/chromeos/login/webui_login_view.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_
+#pragma once
+
+#include "chrome/browser/chromeos/cros/cros_library.h"
oshima 2011/05/18 18:24:54 do you need this?
rharrison 2011/05/19 00:31:43 nope
+#include "chrome/browser/chromeos/login/login_html_dialog.h"
+#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
+#include "views/focus/focus_manager.h"
+#include "views/view.h"
+
+class DOMView;
+class GURL;
+class KeyboardContainerView;
+class NotificationDetails;
+class NotificationSource;
+class Profile;
+
+namespace views {
+class Widget;
+class WindowDelegate;
+}
+
+namespace chromeos {
+
+class StatusAreaView;
+
+// View used to render the webui login during login. WebUILoginView contains
+// StatusAreaView.
+class WebUILoginView : public views::View,
Nikita (slow) 2011/05/18 20:22:12 Seems that we'll be reusing it later for OOBE/Scre
rharrison 2011/05/19 00:31:43 Done.
+ public StatusAreaHost,
+ public chromeos::LoginHtmlDialog::Delegate,
+ public views::FocusChangeListener,
+ public NotificationObserver {
+ public:
+ enum VirtualKeyboardType {
+ NONE,
+ GENERIC,
+ URL,
+ };
+
+ // Internal class name.
+ static const char kViewClassName[];
+
+ WebUILoginView();
+
+ // Initializes the webui login view. It backgroun_url is given (non empty),
Nikita (slow) 2011/05/18 20:22:12 nit: It > if nit: backgroun_url ? Should it be |lo
rharrison 2011/05/19 00:31:43 Done.
+ // it creates a DOMView webui login area that renders a webpage.
+ void Init(const GURL& login_url);
+
+ // Creates a window containing an instance of WizardContentsView as the root
Nikita (slow) 2011/05/18 20:22:12 nit: WizardContentsView > WebUILoginView
rharrison 2011/05/19 00:31:43 Done.
+ // view. The caller is responsible for showing (and closing) the returned
+ // widget. The WebUILoginView is set in |view|. If webui login_url is non
Nikita (slow) 2011/05/18 20:22:12 nit: |login_url|
rharrison 2011/05/19 00:31:43 Done.
+ // empty, the content page of the url is displayed as a webui login.
+ static views::Widget* CreateWindowContainingView(
+ const gfx::Rect& bounds,
+ const GURL& login_url,
+ WebUILoginView** view);
+
+ // Overriden from Views.
Ben Goodger (Google) 2011/05/18 16:50:51 nit: // Overridden from views::View:
rharrison 2011/05/19 00:31:43 Done.
+ virtual std::string GetClassName() const OVERRIDE;
+
+ // Overridden from StatusAreaHost:
+ virtual gfx::NativeWindow GetNativeWindow() const;
+
+ // views::FocusChangeListener implementation
Ben Goodger (Google) 2011/05/18 16:50:51 nit: Overridden from views::FocusChangeListener:
rharrison 2011/05/19 00:31:43 Done.
+ virtual void FocusWillChange(views::View* focused_before,
+ views::View* focused_now);
+
+ // Toggles status area visibility.
Ben Goodger (Google) 2011/05/18 16:50:51 nit: move these public setters above the interface
rharrison 2011/05/19 00:31:43 Removed them since I don't actually use them.
+ void SetStatusAreaVisible(bool visible);
+ // Toggles whether status area is enabled.
+ void SetStatusAreaEnabled(bool enable);
+
+ protected:
+ // Overridden from views::View:
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+ virtual void Layout() OVERRIDE;
+ virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
+
+ // Overridden from StatusAreaHost:
+ virtual Profile* GetProfile() const OVERRIDE { return NULL; }
Nikita (slow) 2011/05/18 20:22:12 Please move to the .cc file since it's a virtual f
rharrison 2011/05/19 00:31:43 Done.
+ virtual void ExecuteBrowserCommand(int id) const OVERRIDE {}
+ virtual bool ShouldOpenButtonOptions(
+ const views::View* button_view) const OVERRIDE;
+ virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE;
+ virtual ScreenMode GetScreenMode() const OVERRIDE;
+ virtual TextStyle GetTextStyle() const OVERRIDE;
+
+ // Overridden from LoginHtmlDialog::Delegate:
+ virtual void OnDialogClosed() OVERRIDE {}
+ virtual void OnLocaleChanged() OVERRIDE;
+
+ private:
+ // Creates and adds the status_area.
+ void InitStatusArea();
+
+ // Invokes SetWindowType for the window. This is invoked during startup and
+ // after we've painted.
+ void UpdateWindowType();
+
+ virtual void InitVirtualKeyboard();
Ben Goodger (Google) 2011/05/18 16:50:51 Why would someone override these? (I see they're v
rharrison 2011/05/19 00:31:43 We don't need to override them. That was an artifa
+ virtual void UpdateKeyboardAndLayout(bool should_show_keyboard);
+ virtual VirtualKeyboardType DecideKeyboardStateForView(views::View* view);
+
+ // Overridden from NotificationObserver.
Nikita (slow) 2011/05/18 20:22:12 nit: indent
rharrison 2011/05/19 00:31:43 Done.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ Profile* profile_;
+
+ StatusAreaView* status_area_;
+
+ // Has Paint been invoked once? The value of this is passed to the window
+ // manager.
+ // TODO(sky): nuke this when the wm knows when chrome has painted.
+ bool did_paint_;
oshima 2011/05/18 18:24:54 do we still need this?
rharrison 2011/05/19 00:31:43 I do not know. I left it in since it was in the co
+
+ // DOMView for rendering a webpage as a webui login.
+ DOMView* webui_login_;
+
+ // Proxy settings dialog that can be invoked from network menu.
+ scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_;
+
+ bool keyboard_showing_;
+ bool focus_listener_added_;
+ KeyboardContainerView* keyboard_;
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebUILoginView);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698