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

Side by Side Diff: chrome/browser/ui/webui/site_settings_helper.cc

Issue 2577043002: Fix content settings for hosted apps not displayed correctly. (Closed)
Patch Set: add tests to verify kDisplayName is set for exceptions and exceptions for hosted apps Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/site_settings_helper.h" 5 #include "chrome/browser/ui/webui/site_settings_helper.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void AddExceptionForHostedApp(const std::string& url_pattern, 111 void AddExceptionForHostedApp(const std::string& url_pattern,
112 const extensions::Extension& app, base::ListValue* exceptions) { 112 const extensions::Extension& app, base::ListValue* exceptions) {
113 std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue()); 113 std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue());
114 114
115 std::string setting_string = 115 std::string setting_string =
116 content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW); 116 content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW);
117 DCHECK(!setting_string.empty()); 117 DCHECK(!setting_string.empty());
118 118
119 exception->SetString(site_settings::kSetting, setting_string); 119 exception->SetString(site_settings::kSetting, setting_string);
120 exception->SetString(site_settings::kOrigin, url_pattern); 120 exception->SetString(site_settings::kOrigin, url_pattern);
121 exception->SetString(site_settings::kDisplayName, url_pattern);
121 exception->SetString(site_settings::kEmbeddingOrigin, url_pattern); 122 exception->SetString(site_settings::kEmbeddingOrigin, url_pattern);
122 exception->SetString(site_settings::kSource, "HostedApp"); 123 exception->SetString(site_settings::kSource, "HostedApp");
123 exception->SetBoolean(site_settings::kIncognito, false); 124 exception->SetBoolean(site_settings::kIncognito, false);
124 exception->SetString(kAppName, app.name()); 125 exception->SetString(kAppName, app.name());
125 exception->SetString(kAppId, app.id()); 126 exception->SetString(kAppId, app.id());
126 exceptions->Append(std::move(exception)); 127 exceptions->Append(std::move(exception));
127 } 128 }
128 129
129 // Create a DictionaryValue* that will act as a data source for a single row 130 // Create a DictionaryValue* that will act as a data source for a single row
130 // in a HostContentSettingsMap-controlled exceptions table (e.g., cookies). 131 // in a HostContentSettingsMap-controlled exceptions table (e.g., cookies).
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 const std::string& name, 349 const std::string& name,
349 const base::DictionaryValue* object) { 350 const base::DictionaryValue* object) {
350 std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue()); 351 std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue());
351 352
352 std::string setting_string = 353 std::string setting_string =
353 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT); 354 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT);
354 DCHECK(!setting_string.empty()); 355 DCHECK(!setting_string.empty());
355 356
356 exception->SetString(site_settings::kSetting, setting_string); 357 exception->SetString(site_settings::kSetting, setting_string);
357 exception->SetString(site_settings::kOrigin, requesting_origin.spec()); 358 exception->SetString(site_settings::kOrigin, requesting_origin.spec());
359 exception->SetString(site_settings::kDisplayName, requesting_origin.spec());
358 exception->SetString( 360 exception->SetString(
359 site_settings::kEmbeddingOrigin, embedding_origin.spec()); 361 site_settings::kEmbeddingOrigin, embedding_origin.spec());
360 exception->SetString(site_settings::kSource, provider_name); 362 exception->SetString(site_settings::kSource, provider_name);
361 exception->SetBoolean(kIncognito, incognito); 363 exception->SetBoolean(kIncognito, incognito);
362 if (object) { 364 if (object) {
363 exception->SetString(kObjectName, name); 365 exception->SetString(kObjectName, name);
364 exception->Set(kObject, object->CreateDeepCopy()); 366 exception->Set(kObject, object->CreateDeepCopy());
365 } 367 }
366 return exception; 368 return exception;
367 } 369 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 454 }
453 } 455 }
454 456
455 for (auto& one_provider_exceptions : all_provider_exceptions) { 457 for (auto& one_provider_exceptions : all_provider_exceptions) {
456 for (auto& exception : one_provider_exceptions) 458 for (auto& exception : one_provider_exceptions)
457 exceptions->Append(std::move(exception)); 459 exceptions->Append(std::move(exception));
458 } 460 }
459 } 461 }
460 462
461 } // namespace site_settings 463 } // namespace site_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698