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

Side by Side Diff: chrome/browser/ui/cocoa/translate/translate_bubble_controller.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include <memory>
8
7 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/translate/chrome_translate_client.h" 10 #include "chrome/browser/translate/chrome_translate_client.h"
10 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
11 #include "components/translate/core/common/translate_errors.h" 12 #include "components/translate/core/common/translate_errors.h"
12 13
13 @class BrowserWindowController; 14 @class BrowserWindowController;
14 15
15 class LanguageComboboxModel; 16 class LanguageComboboxModel;
16 class TranslateBubbleModel; 17 class TranslateBubbleModel;
17 class TranslateDenialComboboxModel; 18 class TranslateDenialComboboxModel;
18 19
19 namespace content { 20 namespace content {
20 class WebContents; 21 class WebContents;
21 } 22 }
22 23
23 // Displays the Translate bubble. The Translate bubble is a bubble which 24 // Displays the Translate bubble. The Translate bubble is a bubble which
24 // pops up when clicking the Translate icon on Omnibox. This bubble 25 // pops up when clicking the Translate icon on Omnibox. This bubble
25 // allows us to translate a foreign page into user-selected language, 26 // allows us to translate a foreign page into user-selected language,
26 // revert this, and configure the translate setting. 27 // revert this, and configure the translate setting.
27 @interface TranslateBubbleController : BaseBubbleController { 28 @interface TranslateBubbleController : BaseBubbleController {
28 @private 29 @private
29 content::WebContents* webContents_; 30 content::WebContents* webContents_;
30 scoped_ptr<TranslateBubbleModel> model_; 31 std::unique_ptr<TranslateBubbleModel> model_;
31 32
32 // The views of each state. The keys are TranslateBubbleModel::ViewState, 33 // The views of each state. The keys are TranslateBubbleModel::ViewState,
33 // and the values are NSView*. 34 // and the values are NSView*.
34 base::scoped_nsobject<NSDictionary> views_; 35 base::scoped_nsobject<NSDictionary> views_;
35 36
36 // The 'Done' or 'Translate' button on the advanced (option) panel. 37 // The 'Done' or 'Translate' button on the advanced (option) panel.
37 NSButton* advancedDoneButton_; 38 NSButton* advancedDoneButton_;
38 39
39 // The 'Cancel' button on the advanced (option) panel. 40 // The 'Cancel' button on the advanced (option) panel.
40 NSButton* advancedCancelButton_; 41 NSButton* advancedCancelButton_;
41 42
42 // The 'Always translate' checkbox on the advanced (option) panel. 43 // The 'Always translate' checkbox on the advanced (option) panel.
43 // This is nil when the current WebContents is in an incognito window. 44 // This is nil when the current WebContents is in an incognito window.
44 NSButton* alwaysTranslateCheckbox_; 45 NSButton* alwaysTranslateCheckbox_;
45 46
46 // The combobox model which is used to deny translation at the view before 47 // The combobox model which is used to deny translation at the view before
47 // translate. 48 // translate.
48 scoped_ptr<TranslateDenialComboboxModel> translateDenialComboboxModel_; 49 std::unique_ptr<TranslateDenialComboboxModel> translateDenialComboboxModel_;
49 50
50 // The combobox model for source languages on the advanced (option) panel. 51 // The combobox model for source languages on the advanced (option) panel.
51 scoped_ptr<LanguageComboboxModel> sourceLanguageComboboxModel_; 52 std::unique_ptr<LanguageComboboxModel> sourceLanguageComboboxModel_;
52 53
53 // The combobox model for target languages on the advanced (option) panel. 54 // The combobox model for target languages on the advanced (option) panel.
54 scoped_ptr<LanguageComboboxModel> targetLanguageComboboxModel_; 55 std::unique_ptr<LanguageComboboxModel> targetLanguageComboboxModel_;
55 56
56 // Whether the translation is actually executed once at least. 57 // Whether the translation is actually executed once at least.
57 BOOL translateExecuted_; 58 BOOL translateExecuted_;
58 } 59 }
59 60
60 @property(readonly, nonatomic) const content::WebContents* webContents; 61 @property(readonly, nonatomic) const content::WebContents* webContents;
61 @property(readonly, nonatomic) const TranslateBubbleModel* model; 62 @property(readonly, nonatomic) const TranslateBubbleModel* model;
62 63
63 - (id)initWithParentWindow:(BrowserWindowController*)controller 64 - (id)initWithParentWindow:(BrowserWindowController*)controller
64 model:(scoped_ptr<TranslateBubbleModel>)model 65 model:(std::unique_ptr<TranslateBubbleModel>)model
65 webContents:(content::WebContents*)webContents; 66 webContents:(content::WebContents*)webContents;
66 - (void)switchView:(TranslateBubbleModel::ViewState)viewState; 67 - (void)switchView:(TranslateBubbleModel::ViewState)viewState;
67 - (void)switchToErrorView:(translate::TranslateErrors::Type)errorType; 68 - (void)switchToErrorView:(translate::TranslateErrors::Type)errorType;
68 69
69 @end 70 @end
70 71
71 // The methods on this category are used internally by the controller and are 72 // The methods on this category are used internally by the controller and are
72 // only exposed for testing purposes. DO NOT USE OTHERWISE. 73 // only exposed for testing purposes. DO NOT USE OTHERWISE.
73 @interface TranslateBubbleController (ExposedForTesting) 74 @interface TranslateBubbleController (ExposedForTesting)
74 - (void)handleTranslateButtonPressed; 75 - (void)handleTranslateButtonPressed;
75 - (void)handleDenialPopUpButtonNopeSelected; 76 - (void)handleDenialPopUpButtonNopeSelected;
76 @end 77 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.h ('k') | chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698