| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return should_expire_; | 125 return should_expire_; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Overridden from ConfirmInfoBarDelegate: | 128 // Overridden from ConfirmInfoBarDelegate: |
| 129 virtual void InfoBarClosed() { | 129 virtual void InfoBarClosed() { |
| 130 if (!action_taken_) | 130 if (!action_taken_) |
| 131 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); | 131 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); |
| 132 delete this; | 132 delete this; |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual std::wstring GetMessageText() const { | 135 virtual string16 GetMessageText() const { |
| 136 return l10n_util::GetString(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); | 136 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); |
| 137 } | 137 } |
| 138 | 138 |
| 139 virtual SkBitmap* GetIcon() const { | 139 virtual SkBitmap* GetIcon() const { |
| 140 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 140 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 141 IDR_PRODUCT_ICON_32); | 141 IDR_PRODUCT_ICON_32); |
| 142 } | 142 } |
| 143 | 143 |
| 144 virtual int GetButtons() const { | 144 virtual int GetButtons() const { |
| 145 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; | 145 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; |
| 146 } | 146 } |
| 147 | 147 |
| 148 virtual std::wstring GetButtonLabel(InfoBarButton button) const { | 148 virtual string16 GetButtonLabel(InfoBarButton button) const { |
| 149 return button == BUTTON_OK ? | 149 return button == BUTTON_OK ? |
| 150 l10n_util::GetString(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) : | 150 l10n_util::GetStringUTF16(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) : |
| 151 l10n_util::GetString(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); | 151 l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); |
| 152 } | 152 } |
| 153 | 153 |
| 154 virtual bool NeedElevation(InfoBarButton button) const { | 154 virtual bool NeedElevation(InfoBarButton button) const { |
| 155 return button == BUTTON_OK; | 155 return button == BUTTON_OK; |
| 156 } | 156 } |
| 157 | 157 |
| 158 virtual bool Accept() { | 158 virtual bool Accept() { |
| 159 action_taken_ = true; | 159 action_taken_ = true; |
| 160 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); | 160 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); |
| 161 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 161 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 public: | 241 public: |
| 242 explicit SessionCrashedInfoBarDelegate(TabContents* contents) | 242 explicit SessionCrashedInfoBarDelegate(TabContents* contents) |
| 243 : ConfirmInfoBarDelegate(contents), | 243 : ConfirmInfoBarDelegate(contents), |
| 244 profile_(contents->profile()) { | 244 profile_(contents->profile()) { |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Overridden from ConfirmInfoBarDelegate: | 247 // Overridden from ConfirmInfoBarDelegate: |
| 248 virtual void InfoBarClosed() { | 248 virtual void InfoBarClosed() { |
| 249 delete this; | 249 delete this; |
| 250 } | 250 } |
| 251 virtual std::wstring GetMessageText() const { | 251 virtual string16 GetMessageText() const { |
| 252 return l10n_util::GetString(IDS_SESSION_CRASHED_VIEW_MESSAGE); | 252 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_MESSAGE); |
| 253 } | 253 } |
| 254 virtual SkBitmap* GetIcon() const { | 254 virtual SkBitmap* GetIcon() const { |
| 255 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 255 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 256 IDR_INFOBAR_RESTORE_SESSION); | 256 IDR_INFOBAR_RESTORE_SESSION); |
| 257 } | 257 } |
| 258 virtual int GetButtons() const { return BUTTON_OK; } | 258 virtual int GetButtons() const { return BUTTON_OK; } |
| 259 virtual std::wstring GetButtonLabel(InfoBarButton button) const { | 259 virtual string16 GetButtonLabel(InfoBarButton button) const { |
| 260 return l10n_util::GetString(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); | 260 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); |
| 261 } | 261 } |
| 262 virtual bool Accept() { | 262 virtual bool Accept() { |
| 263 // Restore the session. | 263 // Restore the session. |
| 264 SessionRestore::RestoreSession(profile_, NULL, true, false, | 264 SessionRestore::RestoreSession(profile_, NULL, true, false, |
| 265 std::vector<GURL>()); | 265 std::vector<GURL>()); |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 private: | 269 private: |
| 270 // The Profile that we restore sessions from. | 270 // The Profile that we restore sessions from. |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 const char* bad_flag = NULL; | 816 const char* bad_flag = NULL; |
| 817 for (const char** flag = kBadFlags; *flag; ++flag) { | 817 for (const char** flag = kBadFlags; *flag; ++flag) { |
| 818 if (command_line_.HasSwitch(*flag)) { | 818 if (command_line_.HasSwitch(*flag)) { |
| 819 bad_flag = *flag; | 819 bad_flag = *flag; |
| 820 break; | 820 break; |
| 821 } | 821 } |
| 822 } | 822 } |
| 823 | 823 |
| 824 if (bad_flag) { | 824 if (bad_flag) { |
| 825 tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab, | 825 tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab, |
| 826 l10n_util::GetStringF(IDS_BAD_FLAGS_WARNING_MESSAGE, | 826 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, |
| 827 L"--" + ASCIIToWide(bad_flag)), | 827 UTF8ToUTF16(std::string("--") + bad_flag)), |
| 828 NULL, false)); | 828 NULL, false)); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 | 831 |
| 832 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( | 832 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( |
| 833 Profile* profile) { | 833 Profile* profile) { |
| 834 std::vector<GURL> urls; | 834 std::vector<GURL> urls; |
| 835 const std::vector<CommandLine::StringType>& params = command_line_.args(); | 835 const std::vector<CommandLine::StringType>& params = command_line_.args(); |
| 836 | 836 |
| 837 for (size_t i = 0; i < params.size(); ++i) { | 837 for (size_t i = 0; i < params.size(); ++i) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 scoped_refptr<AutomationProviderClass> automation = | 1085 scoped_refptr<AutomationProviderClass> automation = |
| 1086 new AutomationProviderClass(profile); | 1086 new AutomationProviderClass(profile); |
| 1087 automation->ConnectToChannel(channel_id); | 1087 automation->ConnectToChannel(channel_id); |
| 1088 automation->SetExpectedTabCount(expected_tabs); | 1088 automation->SetExpectedTabCount(expected_tabs); |
| 1089 | 1089 |
| 1090 AutomationProviderList* list = | 1090 AutomationProviderList* list = |
| 1091 g_browser_process->InitAutomationProviderList(); | 1091 g_browser_process->InitAutomationProviderList(); |
| 1092 DCHECK(list); | 1092 DCHECK(list); |
| 1093 list->AddProvider(automation); | 1093 list->AddProvider(automation); |
| 1094 } | 1094 } |
| OLD | NEW |