Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / content_settings / content_settings_details.h
blob523f9dedb140e74d32313430194ded8952a846b0
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "chrome/common/content_settings.h"
12 #include "chrome/common/content_settings_pattern.h"
13 #include "components/content_settings/core/common/content_settings_types.h"
15 // Details for the CONTENT_SETTINGS_CHANGED notification. This is sent when
16 // content settings change for at least one host. If settings change for more
17 // than one pattern in one user interaction, this will usually send a single
18 // notification with update_all() returning true instead of one notification
19 // for each pattern.
20 class ContentSettingsDetails {
21 public:
22 // Update the setting that matches this pattern/content type/resource.
23 ContentSettingsDetails(const ContentSettingsPattern& primary_pattern,
24 const ContentSettingsPattern& secondary_pattern,
25 ContentSettingsType type,
26 const std::string& resource_identifier);
28 // The item pattern whose settings have changed.
29 const ContentSettingsPattern& primary_pattern() const {
30 return primary_pattern_;
33 // The top level frame pattern whose settings have changed.
34 const ContentSettingsPattern& secondary_pattern() const {
35 return secondary_pattern_;
38 // True if all settings should be updated for the given type.
39 bool update_all() const {
40 return primary_pattern_.ToString().empty() &&
41 secondary_pattern_.ToString().empty();
44 // The type of the pattern whose settings have changed.
45 ContentSettingsType type() const { return type_; }
47 // The resource identifier for the settings type that has changed.
48 const std::string& resource_identifier() const {
49 return resource_identifier_;
52 // True if all types should be updated. If update_all() is false, this will
53 // be false as well (although the reverse does not hold true).
54 bool update_all_types() const {
55 return CONTENT_SETTINGS_TYPE_DEFAULT == type_;
58 private:
59 ContentSettingsPattern primary_pattern_;
60 ContentSettingsPattern secondary_pattern_;
61 ContentSettingsType type_;
62 std::string resource_identifier_;
64 DISALLOW_COPY_AND_ASSIGN(ContentSettingsDetails);
67 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_