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

Unified Diff: chrome/browser/chromeos/webui/login/login_container_ui.cc

Issue 6577003: Entire DOMBrowser stack (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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/webui/login/login_container_ui.cc
diff --git a/chrome/browser/chromeos/webui/login/login_container_ui.cc b/chrome/browser/chromeos/webui/login/login_container_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2354f6c6c939b975017427e5caf16ed588256f62
--- /dev/null
+++ b/chrome/browser/chromeos/webui/login/login_container_ui.cc
@@ -0,0 +1,99 @@
+// Copyright (c) 2010 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.
+
+#include "base/ref_counted_memory.h"
+#include "base/singleton.h"
+#include "base/string_piece.h"
+#include "base/values.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/chromeos/webui/login/browser/dom_browser.h"
+#include "chrome/browser/chromeos/webui/login/login_container_ui.h"
+#include "chrome/browser/chromeos/webui/login/login_ui_helpers.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/common/url_constants.h"
+#include "views/screen.h"
+
+namespace chromeos {
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// LoginContainerUIHTMLSource
+//
+////////////////////////////////////////////////////////////////////////////////
+
+LoginContainerUIHTMLSource::LoginContainerUIHTMLSource(
+ MessageLoop* message_loop)
+ : DataSource(chrome::kChromeUILoginContainerHost, message_loop),
+ html_operations_(new HTMLOperationsInterface()) {
+}
+
+void LoginContainerUIHTMLSource::StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id) {
+ DictionaryValue localized_strings;
+ SetFontAndTextDirection(&localized_strings);
+
+ base::StringPiece login_html = html_operations_->GetLoginContainerHTML();
+ std::string full_html = html_operations_->GetFullHTML(login_html,
+ &localized_strings);
+ scoped_refptr<RefCountedBytes> html_bytes(
+ html_operations_->CreateHTMLBytes(full_html));
+ SendResponse(request_id,
+ (html_bytes.get()));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// LoginContainerUIHandler
+//
+////////////////////////////////////////////////////////////////////////////////
+
+LoginContainerUIHandler::LoginContainerUIHandler()
+ : browser_operations_(new BrowserOperationsInterface),
+ profile_operations_(new ProfileOperationsInterface) {
+}
+
+LoginContainerUIHandler::~LoginContainerUIHandler() {
+}
+
+WebUIMessageHandler* LoginContainerUIHandler::Attach(WebUI* web_ui) {
+ return WebUIMessageHandler::Attach(web_ui);
+}
+
+void LoginContainerUIHandler::RegisterMessages() {
+ web_ui_->RegisterMessageCallback(
+ "OpenLoginScreen",
+ NewCallback(this,
+ &LoginContainerUIHandler::HandleOpenLoginScreen));
+}
+
+void LoginContainerUIHandler::HandleOpenLoginScreen(const ListValue* args) {
+ Profile* profile = profile_operations_->GetDefaultProfileByPath();
+ Browser* current_browser = browser_operations_->GetLoginBrowser(profile);
+ Browser* login_screen = DOMBrowser::CreateForDOM(profile);
+ login_screen->AddSelectedTabWithURL(GURL("chrome://login"),
+ PageTransition::LINK);
+ login_screen->window()->Show();
+ current_browser->CloseWindow();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// LoginContainerUI
+//
+////////////////////////////////////////////////////////////////////////////////
+LoginContainerUI::LoginContainerUI(TabContents* contents)
+ : WebUI(contents) {
+ LoginContainerUIHandler* handler = new LoginContainerUIHandler();
+ AddMessageHandler(handler->Attach(this));
+ LoginContainerUIHTMLSource* html_source =
+ new LoginContainerUIHTMLSource(MessageLoop::current());
+
+ contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/webui/login/login_container_ui.h ('k') | chrome/browser/chromeos/webui/login/login_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698