| Index: chrome/browser/ui/webui/signin/inline_login_ui.cc
|
| diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
|
| index 9366941e55c75205b9b5bc869e16685314d52516..c35321ec12dddba0abd0cdaa65b9194e22bbda27 100644
|
| --- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
|
| +++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
|
| @@ -5,58 +5,25 @@
|
| #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
|
|
|
| #include "base/command_line.h"
|
| -#include "base/files/file_util.h"
|
| -#include "base/path_service.h"
|
| -#include "base/strings/string_split.h"
|
| #include "build/build_config.h"
|
| #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
|
| #include "chrome/browser/extensions/tab_helper.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/sessions/session_tab_helper.h"
|
| #include "chrome/browser/ui/webui/metrics_handler.h"
|
| -#include "chrome/common/chrome_paths.h"
|
| +#include "chrome/browser/ui/webui/test_files_request_filter.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/grit/chromium_strings.h"
|
| -#include "components/guest_view/browser/guest_view_manager.h"
|
| #include "components/signin/core/common/profile_management_switches.h"
|
| -#include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/web_ui.h"
|
| #include "content/public/browser/web_ui_data_source.h"
|
| #include "content/public/common/content_switches.h"
|
| -#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
| #include "grit/browser_resources.h"
|
| -#if defined(OS_CHROMEOS)
|
| -#include "chrome/browser/chromeos/login/startup_utils.h"
|
| -#include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h"
|
| -#else
|
| #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
|
| -#endif
|
|
|
| namespace {
|
|
|
| -bool HandleTestFileRequestCallback(
|
| - const std::string& path,
|
| - const content::WebUIDataSource::GotDataCallback& callback) {
|
| - std::vector<std::string> url_substr = base::SplitString(
|
| - path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
| - if (url_substr.size() != 2 || url_substr[0] != "test")
|
| - return false;
|
| -
|
| - std::string contents;
|
| - base::FilePath test_data_dir;
|
| - PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
|
| - if (!base::ReadFileToString(
|
| - test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]),
|
| - &contents, std::string::npos))
|
| - return false;
|
| -
|
| - base::RefCountedString* ref_contents = new base::RefCountedString();
|
| - ref_contents->data() = contents;
|
| - callback.Run(ref_contents);
|
| - return true;
|
| -}
|
| -
|
| content::WebUIDataSource* CreateWebUIDataSource() {
|
| content::WebUIDataSource* source =
|
| content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost);
|
| @@ -71,7 +38,7 @@ content::WebUIDataSource* CreateWebUIDataSource() {
|
| const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
|
| command_line->HasSwitch(::switches::kTestType);
|
| if (is_running_test)
|
| - source->SetRequestFilter(base::Bind(&HandleTestFileRequestCallback));
|
| + source->SetRequestFilter(test::GetTestFilesRequestFilter());
|
|
|
| source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS);
|
| source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
|
| @@ -81,15 +48,6 @@ content::WebUIDataSource* CreateWebUIDataSource() {
|
| return source;
|
| }
|
|
|
| -bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
|
| - const std::string& web_view_name,
|
| - content::WebContents* web_contents) {
|
| - auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
|
| - if (web_view && web_view->name() == web_view_name)
|
| - frame_set->insert(web_contents);
|
| - return false;
|
| -}
|
| -
|
| } // empty namespace
|
|
|
| InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
|
| @@ -97,12 +55,7 @@ InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
|
| auth_extension_(Profile::FromWebUI(web_ui)) {
|
| Profile* profile = Profile::FromWebUI(web_ui);
|
| content::WebUIDataSource::Add(profile, CreateWebUIDataSource());
|
| -
|
| -#if defined(OS_CHROMEOS)
|
| - web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS());
|
| -#else
|
| web_ui->AddMessageHandler(new InlineLoginHandlerImpl());
|
| -#endif
|
| web_ui->AddMessageHandler(new MetricsHandler());
|
|
|
| content::WebContents* contents = web_ui->GetWebContents();
|
| @@ -120,32 +73,3 @@ InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
|
|
|
| InlineLoginUI::~InlineLoginUI() {}
|
|
|
| -// Gets the Gaia iframe within a WebContents.
|
| -content::RenderFrameHost* InlineLoginUI::GetAuthFrame(
|
| - content::WebContents* web_contents,
|
| - const GURL& parent_origin,
|
| - const std::string& parent_frame_name) {
|
| - content::WebContents* auth_web_contents = GetAuthFrameWebContents(
|
| - web_contents, parent_origin, parent_frame_name);
|
| - return auth_web_contents ? auth_web_contents->GetMainFrame() : nullptr;
|
| -}
|
| -
|
| -content::WebContents* InlineLoginUI::GetAuthFrameWebContents(
|
| - content::WebContents* web_contents,
|
| - const GURL& parent_origin,
|
| - const std::string& parent_frame_name) {
|
| - std::set<content::WebContents*> frame_set;
|
| - auto* manager =
|
| - guest_view::GuestViewManager::FromBrowserContext(
|
| - web_contents->GetBrowserContext());
|
| - if (manager) {
|
| - manager->ForEachGuest(
|
| - web_contents,
|
| - base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
|
| - }
|
| - DCHECK_GE(1U, frame_set.size());
|
| - if (!frame_set.empty())
|
| - return *frame_set.begin();
|
| -
|
| - return nullptr;
|
| -}
|
|
|