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

Issue 46078: Mac bookmark work. ... (Closed)

Created:
11 years, 9 months ago by John Grabowski
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, jeremy
Visibility:
Public.

Description

Mac bookmark work. - The bookmark menu is populated dynamically with bookmarks, including subfolders --> submenus. E.g. star something --> shows up in menu. Menu items are disabled but always present and current. - Always Show Bookmarks" menu now live; reads from / writes to preference, and shows correct "toggle state". - Bookmark bar on each tab, present if requested. (Currently an empty box). - Random stuff; e.g. bookmark prefs init moved to a x-plat location. This CL does not contain Cole's views. Bried english description of the nib file changes: - add a new view for the bookmark bar in the tab; hook it up to the controller - Many tag sets (e.g. View-->Always Show Bookmarks Bar now 40009) - Remove dummy bookmark menu items Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=11936

Patch Set 1 #

Total comments: 23

Patch Set 2 : '' #

Total comments: 30

Patch Set 3 : '' #

Total comments: 3

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+815 lines, -240 lines) Patch
M chrome/app/chrome_dll_resource.h View 1 2 3 4 5 6 7 8 2 chunks +12 lines, -2 lines 0 comments Download
M chrome/app/nibs/en.lproj/MainMenu.xib View 1 2 3 4 5 6 7 8 16 chunks +29 lines, -139 lines 0 comments Download
M chrome/app/nibs/en.lproj/TabContents.xib View 1 2 3 4 5 6 7 8 9 chunks +74 lines, -4 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_context_menu.cc View 1 2 3 4 5 6 7 8 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_utils.h View 1 2 3 4 5 6 7 8 2 chunks +8 lines, -0 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_utils.cc View 1 2 3 4 5 6 7 8 2 chunks +32 lines, -0 lines 0 comments Download
M chrome/browser/browser.h View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/browser.cc View 1 2 3 4 5 6 7 8 2 chunks +11 lines, -0 lines 0 comments Download
M chrome/browser/browser_prefs.cc View 1 2 3 4 5 6 7 8 3 chunks +2 lines, -6 lines 0 comments Download
A chrome/browser/cocoa/bookmark_bar_state_controller.h View 1 1 chunk +36 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/bookmark_bar_state_controller.mm View 1 2 3 4 5 1 chunk +38 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/bookmark_bar_state_controller_unittest.mm View 1 2 3 4 5 1 chunk +45 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/bookmark_menu_bridge.h View 1 2 1 chunk +56 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/bookmark_menu_bridge.mm View 1 2 1 chunk +110 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/bookmark_menu_bridge_unittest.mm View 1 2 3 4 5 1 chunk +107 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/browser_test_helper.h View 1 chunk +38 lines, -0 lines 0 comments Download
M chrome/browser/cocoa/browser_window_cocoa.h View 1 2 3 4 5 6 7 8 3 chunks +10 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/browser_window_cocoa.mm View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -5 lines 0 comments Download
M chrome/browser/cocoa/browser_window_controller.h View 1 2 3 4 5 6 7 8 3 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/cocoa/browser_window_controller.mm View 1 2 3 4 5 6 7 8 6 chunks +44 lines, -8 lines 0 comments Download
M chrome/browser/cocoa/tab_contents_controller.h View 1 2 3 4 5 6 7 8 6 chunks +25 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/tab_contents_controller.mm View 1 2 3 4 5 6 7 8 6 chunks +47 lines, -1 line 0 comments Download
M chrome/browser/cocoa/tab_strip_controller.h View 1 2 3 4 5 6 7 8 4 chunks +19 lines, -7 lines 0 comments Download
M chrome/browser/cocoa/tab_strip_controller.mm View 1 2 3 4 5 6 7 8 5 chunks +31 lines, -10 lines 0 comments Download
M chrome/browser/views/bookmark_bar_view.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -6 lines 0 comments Download
M chrome/browser/views/bookmark_bar_view.cc View 1 2 3 4 5 6 7 8 9 2 chunks +1 line, -23 lines 0 comments Download
M chrome/browser/views/bookmark_table_view.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/views/bookmark_table_view.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -9 lines 0 comments Download
M chrome/browser/views/frame/browser_view.cc View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -1 line 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 7 8 3 chunks +10 lines, -4 lines 0 comments Download
M chrome/common/temp_scaffolding_stubs.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/test/testing_profile.h View 1 2 3 4 5 6 7 8 2 chunks +1 line, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
John Grabowski
This will probably fail the try servers (conflict with recent pink tabs changes) but I ...
11 years, 9 months ago (2009-03-14 02:55:23 UTC) #1
TVL
drive by nits. :) http://codereview.chromium.org/46078/diff/1/3 File chrome/app/chrome_dll_resource.h (right): http://codereview.chromium.org/46078/diff/1/3#newcode3 Line 3: // Used by chrome_dll.rc ...
11 years, 9 months ago (2009-03-16 12:29:14 UTC) #2
Avi (use Gerrit)
What he said, plus... (but mostly nits; LG otherwise) http://codereview.chromium.org/46078/diff/1/21 File chrome/browser/cocoa/bookmark_menu_bridge.h (right): http://codereview.chromium.org/46078/diff/1/21#newcode50 Line ...
11 years, 9 months ago (2009-03-16 14:49:33 UTC) #3
John Grabowski
New diffs uploaded. http://codereview.chromium.org/46078/diff/1/13 File chrome/browser/cocoa/bookmark_bar_state_controller.h (right): http://codereview.chromium.org/46078/diff/1/13#newcode15 Line 15: @private On 2009/03/16 12:29:14, TVL ...
11 years, 9 months ago (2009-03-17 00:27:30 UTC) #4
John Grabowski
tvl sez: >> drive by nits. :) Drive by anytime!
11 years, 9 months ago (2009-03-17 01:04:22 UTC) #5
Mark Mentovai
Drive-bys from me too. This was a big job, and a nice job. LGTM with ...
11 years, 9 months ago (2009-03-17 02:52:25 UTC) #6
John Grabowski
Applied Mark's comments, did a sync/merge, and uploaded new diffs. If the try servers are ...
11 years, 9 months ago (2009-03-17 17:48:21 UTC) #7
Mark Mentovai
http://codereview.chromium.org/46078/diff/1048/1070 File chrome/browser/cocoa/bookmark_bar_state_controller_unittest.mm (right): http://codereview.chromium.org/46078/diff/1048/1070#newcode40 Line 40: EXPECT_NE(old_visible, [c visible]); Doesn't this have the same ...
11 years, 9 months ago (2009-03-17 18:12:49 UTC) #8
John Grabowski
http://codereview.chromium.org/46078/diff/1048/1070 File chrome/browser/cocoa/bookmark_bar_state_controller_unittest.mm (right): http://codereview.chromium.org/46078/diff/1048/1070#newcode40 Line 40: EXPECT_NE(old_visible, [c visible]); On 2009/03/17 18:12:49, Mark Mentovai ...
11 years, 9 months ago (2009-03-17 18:20:44 UTC) #9
Mark Mentovai
11 years, 9 months ago (2009-03-17 18:48:05 UTC) #10
http://codereview.chromium.org/46078/diff/1048/1070
File chrome/browser/cocoa/bookmark_bar_state_controller_unittest.mm (right):

http://codereview.chromium.org/46078/diff/1048/1070#newcode40
Line 40: EXPECT_NE(old_visible, [c visible]);
jrg wrote:
> I do not agree that BOOL comparison is shady.  A constraint such as "can't
> compare BOOLs" would make them less than useful.
> 
> Can you elaborate on your suspicion?

A BOOL may be neither YES nor NO, in which case it evaluates as true in a
boolean context but isn't strictly valid for comparison against another BOOL.

http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=BOOL_...

"Be careful with BOOL return values and mixing bool with BOOL. Avoid comparing
directly with YES."

which I read as meaning, by extension, "avoid directly comparing BOOL variables
that may contain YES."

There's also this: "Also be careful when interoperating with C++ and its bool
type. Don't just assume that YES and NO map directly to true and false. You can
use the ternary operator to succinctly map between them."  Now, note that in
bookmark_bar_state_controller.mm:34, you've (maybe without realizing) added
bool<->BOOL interoperation.  Although it happens to be a completely safe use
there, you wind up storing static_cast<BOOL>(true) and static_cast<BOOL>(false)
to visible_.  static_cast<BOOL>(true) may be distinct from YES.  Now, there's
nothing wrong with bookmark_bar_state_controller.mm, because a promoted bool
just winds up as 0 or 1, both of which are totally safe to stick in a BOOL.  But
there is something wrong with assuming that YES and 1 are the same, which is
what you've done on this line and on line 44.  YES is true, but true is not
necessarily YES.

Rather than relying (and forcing) NO==false and YES==true throughout the rest of
the code, it's far better to just put things into the right boolean context
whenever you need these sorts of comparisons.  This doesn't obviate other code's
responsibility for ensuring that its bool<->BOOL conversions are safe.

This isn't just mental masturbation.  I've seen it happen in the wild, fo'
sho'...

Powered by Google App Engine
This is Rietveld 408576698