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

Issue 6490016: DOM UI options handler cleanup: (Closed)

Created:
9 years, 10 months ago by Evan Stade
Modified:
9 years, 6 months ago
Reviewers:
Mike Mammarella
CC:
chromium-reviews
Visibility:
Public.

Description

DOM UI options handler cleanup: - improve StripColon - remove superfluous parens (clang would catch these if they weren't inside ifdefs) - move a couple more files to the abbreviated string definition style - use SetBoolean rather than SetString("true") BUG=none TEST=trybots Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=74860

Patch Set 1 #

Patch Set 2 : indent #

Total comments: 6

Patch Set 3 : remove colon DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+131 lines, -212 lines) Patch
M chrome/app/generated_resources.grd View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/dom_ui/options/about_page_handler.cc View 1 2 2 chunks +26 lines, -39 lines 0 comments Download
M chrome/browser/dom_ui/options/advanced_options_handler.cc View 1 2 8 chunks +14 lines, -14 lines 0 comments Download
M chrome/browser/dom_ui/options/browser_options_handler.cc View 1 2 1 chunk +23 lines, -41 lines 0 comments Download
M chrome/browser/dom_ui/options/content_settings_handler.cc View 1 2 1 chunk +60 lines, -113 lines 0 comments Download
M chrome/browser/dom_ui/options/dom_options_util.cc View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/dom_ui/options/language_options_handler_common.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Evan Stade
9 years, 10 months ago (2011-02-11 01:55:11 UTC) #1
Mike Mammarella
LGTM + a few unimportant comments http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/options/advanced_options_handler.cc File chrome/browser/dom_ui/options/advanced_options_handler.cc (left): http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/options/advanced_options_handler.cc#oldcode379 chrome/browser/dom_ui/options/advanced_options_handler.cc:379: bool enabled = ...
9 years, 10 months ago (2011-02-11 18:38:48 UTC) #2
Evan Stade
http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/options/advanced_options_handler.cc File chrome/browser/dom_ui/options/advanced_options_handler.cc (left): http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/options/advanced_options_handler.cc#oldcode379 chrome/browser/dom_ui/options/advanced_options_handler.cc:379: bool enabled = (checked_str == "true"); On 2011/02/11 18:38:48, ...
9 years, 10 months ago (2011-02-11 19:23:32 UTC) #3
Mike Mammarella
9 years, 10 months ago (2011-02-11 20:56:19 UTC) #4
http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/option...
File chrome/browser/dom_ui/options/advanced_options_handler.cc (left):

http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/option...
chrome/browser/dom_ui/options/advanced_options_handler.cc:379: bool enabled =
(checked_str == "true");
On 2011/02/11 19:23:33, Evan Stade wrote:
> On 2011/02/11 18:38:48, Mike Mammarella wrote:
> > Personally I like these parens, because they make it clear that I'm not
> > assigning checked_str to enabled and then comparing the result to "true" and
> > throwing that away. In this case the types make that mostly clear, but you
> never
> > can tell what C++ might do with implicit conversions and such...
> > 
> > Does clang really not like them usually?
> 
> well, I think clang would complain, but I guess I'm not positive. When an
> assignment is used as a truth value, g++ warns unless you put extra parens
> around it (to prove you really mean it). Transversely, extra parens around a
> comparison could indicate that you meant to do an assignment, so clang warns.
> 
> What I'm not positive about is if assigning to a bool variable counts the same
> as a truth value in the context of if().
> 
> p.s. what makes this clear for me is operator precedence, not the types

Yeah, there are just some operators that I don't always remember the precedence
of, and that I've gotten wrong in the past, so I tend to try and avoid counting
on anything other than the simple ones that everybody remembers. Maybe I'm just
weird in not remembering = vs ==...

Overall LGTM in any event.

http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/option...
File chrome/browser/dom_ui/options/dom_options_util.cc (right):

http://codereview.chromium.org/6490016/diff/1001/chrome/browser/dom_ui/option...
chrome/browser/dom_ui/options/dom_options_util.cc:12: const string16::value_type
kColon[] = { ':', 0 };
On 2011/02/11 19:23:33, Evan Stade wrote:
> On 2011/02/11 18:38:48, Mike Mammarella wrote:
> > Doesn't the style guide say not to use spaces after { and before } here?
(The
> > sawzall style guide requires them, but I think C++ says not to.)
> 
> optional, apparently:
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Horizo...
> 
> but I believe using them is more common than not within chrome's codebase

OK then.

Powered by Google App Engine
This is Rietveld 408576698