Bug 21856 - Need a way to store and retrieve preferences for the Web Inspector
: Need a way to store and retrieve preferences for the Web Inspector
Status: RESOLVED FIXED
: WebKit
Web Inspector (Deprecated)
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-10-24 10:00 PST by
Modified: 2008-10-24 11:49 PST (History)


Attachments
Proposed patch (41.71 KB, patch)
2008-10-24 10:17 PST, Timothy Hatcher
darin: review+
Review Patch | Details | Formatted Diff | Diff
Proposed patch (round two) (43.15 KB, patch)
2008-10-24 11:31 PST, Timothy Hatcher
timothy: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-10-24 10:00:04 PST
The time has come where we need to have preferences that persist for the Web Inspector. So we need a way to access them from C++ and JavaScript and have them persist (preferably in the application's preferences.)
------- Comment #1 From 2008-10-24 10:17:47 PST -------
Created an attachment (id=24642) [details]
Proposed patch
------- Comment #2 From 2008-10-24 10:43:56 PST -------
(From update of attachment 24642 [details])
> +        typedef enum {
> +            NoType, StringType, StringVectorType, DoubleType, IntegerType, BooleanType
> +        } Type;

You should just use "enum Type { }" syntax.

> +        Setting(const Setting& o)
> +            : m_type(o.m_type)
> +            , m_string(o.m_string)
> +            , m_stringVector(o.m_stringVector)
> +            , m_simpleContent(o.m_simpleContent)
> +        {
> +        }
> +
> +        Setting& operator=(const Setting& o)
> +        {
> +            m_type = o.m_type;
> +            m_string = o.m_string;
> +            m_stringVector = o.m_stringVector;
> +            m_simpleContent = o.m_simpleContent;
> +            return *this;
> +        }

These are the same as what the compiler generates if you don't declare the operator at all. Just leave these out and it should work the same.

> @@ -405,6 +405,10 @@ public:
>      virtual void highlight(Node*) {};
>      virtual void hideHighlight() {};
>      virtual void inspectedURLChanged(const String& newURL) {};
> +
> +    virtual void populateSetting(const String& key, InspectorController::Setting&) {};
> +    virtual void storeSetting(const String& key, const InspectorController::Setting&) {};
> +    virtual void removeSetting(const String& key) {};

All these semicolons at the ends of lines after {} are unneeded and should be omitted.

> +    // FIXME: this can be shared between Mac and Windows, this is currently copied code.

Why not make a shared source file and do this now? Is there some obstacle?

r=me
------- Comment #3 From 2008-10-24 11:31:37 PST -------
Created an attachment (id=24643) [details]
Proposed patch (round two)
------- Comment #4 From 2008-10-24 11:43:15 PST -------
(From update of attachment 24643 [details])
Adam reviewed the windows parts of this. The rest is basically the same from the patch Darin reviewed, with his suggestions fixed.
------- Comment #5 From 2008-10-24 11:49:58 PST -------
Landed in r37848.