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

Unified Diff: chrome/browser/guest_view/web_view/javascript_dialog_helper.cc

Issue 257823005: [Sheriff] Revert "Revert "Revert 266297 "1. Handle the case of empty embedder_extension_id...""" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/guest_view/web_view/javascript_dialog_helper.cc
diff --git a/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc b/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc
deleted file mode 100644
index 2c198e5c70e900fe1bfa1813446738324aba7453..0000000000000000000000000000000000000000
--- a/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2014 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 "chrome/browser/guest_view/web_view/javascript_dialog_helper.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/guest_view/guest_view_constants.h"
-#include "chrome/browser/guest_view/web_view/web_view_constants.h"
-#include "chrome/browser/guest_view/web_view/web_view_guest.h"
-#include "chrome/browser/guest_view/web_view/web_view_permission_types.h"
-
-namespace {
-
-std::string JavaScriptMessageTypeToString(
- content::JavaScriptMessageType message_type) {
- switch (message_type) {
- case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
- return "alert";
- case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
- return "confirm";
- case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
- return "prompt";
- default:
- NOTREACHED() << "Unknown JavaScript Message Type.";
- return "unknown";
- }
-}
-
-} // namespace
-
-JavaScriptDialogHelper::JavaScriptDialogHelper(WebViewGuest* guest)
- : webview_guest_(guest) {
-}
-
-JavaScriptDialogHelper::~JavaScriptDialogHelper() {
-}
-
-void JavaScriptDialogHelper::RunJavaScriptDialog(
- content::WebContents* web_contents,
- const GURL& origin_url,
- const std::string& accept_lang,
- content::JavaScriptMessageType javascript_message_type,
- const base::string16& message_text,
- const base::string16& default_prompt_text,
- const DialogClosedCallback& callback,
- bool* did_suppress_message) {
- base::DictionaryValue request_info;
- request_info.Set(
- webview::kDefaultPromptText,
- base::Value::CreateStringValue(base::UTF16ToUTF8(default_prompt_text)));
- request_info.Set(
- webview::kMessageText,
- base::Value::CreateStringValue(base::UTF16ToUTF8(message_text)));
- request_info.Set(
- webview::kMessageType,
- base::Value::CreateStringValue(
- JavaScriptMessageTypeToString(javascript_message_type)));
- request_info.Set(
- guestview::kUrl,
- base::Value::CreateStringValue(origin_url.spec()));
- webview_guest_->RequestPermission(
- static_cast<BrowserPluginPermissionType>(
- WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG),
- request_info,
- base::Bind(&JavaScriptDialogHelper::OnPermissionResponse,
- base::Unretained(this),
- callback),
- false /* allowed_by_default */);
-}
-
-void JavaScriptDialogHelper::RunBeforeUnloadDialog(
- content::WebContents* web_contents,
- const base::string16& message_text,
- bool is_reload,
- const DialogClosedCallback& callback) {
- // This is called if the guest has a beforeunload event handler.
- // This callback allows navigation to proceed.
- callback.Run(true, base::string16());
-}
-
-bool JavaScriptDialogHelper::HandleJavaScriptDialog(
- content::WebContents* web_contents,
- bool accept,
- const base::string16* prompt_override) {
- return false;
-}
-
-void JavaScriptDialogHelper::CancelActiveAndPendingDialogs(
- content::WebContents* web_contents) {
-}
-
-void JavaScriptDialogHelper::WebContentsDestroyed(
- content::WebContents* web_contents) {
-}
-
-void JavaScriptDialogHelper::OnPermissionResponse(
- const DialogClosedCallback& callback,
- bool allow,
- const std::string& user_input) {
- callback.Run(allow && webview_guest_->attached(),
- base::UTF8ToUTF16(user_input));
-}

Powered by Google App Engine
This is Rietveld 408576698