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

Issue 10952016: Simplify the translate infobar code some. (Closed)

Created:
8 years, 3 months ago by Peter Kasting
Modified:
8 years, 3 months ago
Reviewers:
Elliot Glaysher, sail, sky
CC:
chromium-reviews, tfarina
Visibility:
Public.

Description

Simplify the translate infobar code some. The primary change here is to take LanguagesMenuModel, which was used by views, unused by GTK, and only "used" by Cocoa to get the appropriate language names for a menu (which can be done by calling functions on the TranslateInfobarDelegate directly), and make it truly views-specific. In turn this means we can get rid of the TranslateInfoBarView class, which was only ever used by views even though all platforms included it. Instead, the SetOriginalLanguage() and SetTargetLanguage() functions on the infobar delegate now become simple setters, and each platform calls Translate() as a followup directly where appropriate. (This split was necessary because views needed to maintain the current calling order, where the delegate updates the language index, then the infobar updates the button text, then Translate() is called.) Along the way we also make a number of delegate functions unix_hacker()-style inline getters/setters, and remove some unnecessary "virtual" declarations on functions never overridden. Finally there are a bunch of other small code simplifications. BUG=100840 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=157889

Patch Set 1 #

Total comments: 3

Patch Set 2 : #

Patch Set 3 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+228 lines, -449 lines) Patch
M chrome/browser/policy/policy_browsertest.cc View 1 1 chunk +1 line, -1 line 0 comments Download
D chrome/browser/translate/languages_menu_model.h View 1 1 chunk +0 lines, -40 lines 0 comments Download
D chrome/browser/translate/languages_menu_model.cc View 1 1 chunk +0 lines, -53 lines 0 comments Download
M chrome/browser/translate/options_menu_model.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/translate/translate_infobar_delegate.h View 1 5 chunks +31 lines, -18 lines 0 comments Download
M chrome/browser/translate/translate_infobar_delegate.cc View 1 11 chunks +21 lines, -66 lines 0 comments Download
D chrome/browser/translate/translate_infobar_view.h View 1 1 chunk +0 lines, -19 lines 0 comments Download
M chrome/browser/translate/translate_manager_browsertest.cc View 1 4 chunks +11 lines, -9 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.mm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/translate_infobar_base.h View 1 2 chunks +0 lines, -3 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm View 1 2 6 chunks +26 lines, -61 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm View 1 1 chunk +5 lines, -16 lines 2 comments Download
M chrome/browser/ui/gtk/infobars/after_translate_infobar_gtk.cc View 1 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/ui/gtk/infobars/before_translate_infobar_gtk.cc View 1 3 chunks +8 lines, -13 lines 0 comments Download
M chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/infobars/after_translate_infobar.h View 1 3 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/infobars/after_translate_infobar.cc View 1 4 chunks +18 lines, -34 lines 0 comments Download
M chrome/browser/ui/views/infobars/before_translate_infobar.h View 1 3 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/ui/views/infobars/before_translate_infobar.cc View 1 5 chunks +12 lines, -23 lines 0 comments Download
M chrome/browser/ui/views/infobars/translate_infobar_base.h View 1 3 chunks +5 lines, -9 lines 0 comments Download
M chrome/browser/ui/views/infobars/translate_infobar_base.cc View 1 3 chunks +14 lines, -31 lines 0 comments Download
A + chrome/browser/ui/views/infobars/translate_language_menu_model.h View 2 chunks +22 lines, -10 lines 2 comments Download
A + chrome/browser/ui/views/infobars/translate_language_menu_model.cc View 1 chunk +37 lines, -24 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/chrome_browser_ui.gypi View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Peter Kasting
Sailesh, if you can patch this in locally and ensure translate infobars still work correctly ...
8 years, 3 months ago (2012-09-19 00:42:02 UTC) #1
sail
I applied the patch locally and try the translate infobar. Clicking translate and show original ...
8 years, 3 months ago (2012-09-19 02:13:31 UTC) #2
Peter Kasting
So, is that an R+ then? (Try changing languages in the menus on both the ...
8 years, 3 months ago (2012-09-19 02:37:26 UTC) #3
sail
cocoa/* LGTM! https://codereview.chromium.org/10952016/diff/3009/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm File chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm (right): https://codereview.chromium.org/10952016/diff/3009/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm#newcode62 chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm:62: virtual bool IsLanguageBlacklisted() { return false; } ...
8 years, 3 months ago (2012-09-19 04:44:05 UTC) #4
Peter Kasting
+sky for views +erg for GTK and anything cross-platform (not sure of a good reviewer ...
8 years, 3 months ago (2012-09-19 04:53:32 UTC) #5
sky
LGTM https://codereview.chromium.org/10952016/diff/3009/chrome/browser/ui/views/infobars/translate_language_menu_model.h File chrome/browser/ui/views/infobars/translate_language_menu_model.h (right): https://codereview.chromium.org/10952016/diff/3009/chrome/browser/ui/views/infobars/translate_language_menu_model.h#newcode25 chrome/browser/ui/views/infobars/translate_language_menu_model.h:25: TranslateLanguageMenuModel(LanguageType language_type, nit: newline between 24/25 https://codereview.chromium.org/10952016/diff/3009/chrome/browser/ui/views/infobars/translate_language_menu_model.h#newcode47 chrome/browser/ui/views/infobars/translate_language_menu_model.h:47: ...
8 years, 3 months ago (2012-09-19 14:18:06 UTC) #6
Elliot Glaysher
8 years, 3 months ago (2012-09-19 16:38:16 UTC) #7
gtk lgtm

Powered by Google App Engine
This is Rietveld 408576698