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

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 10951020: Show a helpful error message if a host domain policy blocked an attempt to use (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 8 years, 3 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
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/webapp/_locales/en/messages.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 043bc7546765cf4cbc126bb6be2e601ff9fed31f..15b5ceef9188c47de9f77768cfec162e88f31107 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -72,6 +72,7 @@ const char* kAttrNameReceivedAccessCode = "RECEIVED_ACCESS_CODE";
const char* kAttrNameConnected = "CONNECTED";
const char* kAttrNameDisconnecting = "DISCONNECTING";
const char* kAttrNameError = "ERROR";
+const char* kAttrNameInvalidDomainError = "INVALID_DOMAIN_ERROR";
const int kMaxLoginAttempts = 5;
@@ -315,6 +316,9 @@ bool HostNPScriptObject::GetProperty(const std::string& property_name,
} else if (property_name == kAttrNameError) {
INT32_TO_NPVARIANT(kError, *result);
return true;
+ } else if (property_name == kAttrNameInvalidDomainError) {
+ INT32_TO_NPVARIANT(kInvalidDomainError, *result);
+ return true;
} else {
SetException("GetProperty: unsupported property " + property_name);
return false;
@@ -545,7 +549,7 @@ void HostNPScriptObject::FinishConnect(
// Check the host domain policy.
if (!required_host_domain_.empty() &&
!EndsWith(uid, std::string("@") + required_host_domain_, false)) {
- SetState(kError);
+ SetState(kInvalidDomainError);
return;
}
@@ -1035,7 +1039,8 @@ void HostNPScriptObject::SetState(State state) {
case kStarting:
DCHECK(state == kRequestedAccessCode ||
state == kDisconnecting ||
- state == kError) << state;
+ state == kError ||
+ state == kInvalidDomainError) << state;
break;
case kRequestedAccessCode:
DCHECK(state == kReceivedAccessCode ||
@@ -1058,6 +1063,9 @@ void HostNPScriptObject::SetState(State state) {
case kError:
DCHECK(state == kDisconnecting) << state;
break;
+ case kInvalidDomainError:
+ DCHECK(state == kDisconnecting) << state;
+ break;
};
state_ = state;
NotifyStateChanged(state);
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/webapp/_locales/en/messages.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698