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

Side by Side Diff: chrome/browser/translate/options_menu_model.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/translate/options_menu_model.h" 5 #include "chrome/browser/translate/options_menu_model.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/translate/translate_infobar_delegate.h" 10 #include "chrome/browser/translate/translate_infobar_delegate.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/public/browser/navigation_controller.h" 12 #include "content/public/browser/navigation_controller.h"
13 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/locale_settings.h" 16 #include "grit/locale_settings.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 18
19 using content::NavigationEntry; 19 using content::NavigationEntry;
20 using content::OpenURLParams; 20 using content::OpenURLParams;
21 using content::Referrer; 21 using content::Referrer;
22 using content::WebContents; 22 using content::WebContents;
23 23
24 OptionsMenuModel::OptionsMenuModel( 24 OptionsMenuModel::OptionsMenuModel(
25 TranslateInfoBarDelegate* translate_delegate) 25 TranslateInfoBarDelegate* translate_delegate)
26 : ui::SimpleMenuModel(this), 26 : ui::SimpleMenuModel(this),
27 translate_infobar_delegate_(translate_delegate) { 27 translate_infobar_delegate_(translate_delegate) {
28 // |translate_delegate| must already be owned.
29 DCHECK(translate_infobar_delegate_->web_contents());
30
28 string16 original_language = translate_delegate->language_name_at( 31 string16 original_language = translate_delegate->language_name_at(
29 translate_delegate->original_language_index()); 32 translate_delegate->original_language_index());
30 string16 target_language = translate_delegate->language_name_at( 33 string16 target_language = translate_delegate->language_name_at(
31 translate_delegate->target_language_index()); 34 translate_delegate->target_language_index());
32 35
33 bool autodetermined_source_language = 36 bool autodetermined_source_language =
34 translate_delegate->original_language_index() == 37 translate_delegate->original_language_index() ==
35 TranslateInfoBarDelegate::kNoIndex; 38 TranslateInfoBarDelegate::kNoIndex;
36 39
37 // Populate the menu. 40 // Populate the menu.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 web_contents->OpenURL(params); 133 web_contents->OpenURL(params);
131 } 134 }
132 break; 135 break;
133 } 136 }
134 137
135 default: 138 default:
136 NOTREACHED() << "Invalid command id from menu."; 139 NOTREACHED() << "Invalid command id from menu.";
137 break; 140 break;
138 } 141 }
139 } 142 }
OLDNEW
« no previous file with comments | « chrome/browser/three_d_api_observer.cc ('k') | chrome/browser/translate/translate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698