| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser_init.h" | 5 #include "chrome/browser/ui/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "chrome/browser/chromeos/wm_overview_controller.h" | 94 #include "chrome/browser/chromeos/wm_overview_controller.h" |
| 95 #include "chrome/browser/dom_ui/mediaplayer_ui.h" | 95 #include "chrome/browser/dom_ui/mediaplayer_ui.h" |
| 96 #endif | 96 #endif |
| 97 | 97 |
| 98 #if defined(HAVE_XINPUT2) | 98 #if defined(HAVE_XINPUT2) |
| 99 #include "views/focus/accelerator_handler.h" | 99 #include "views/focus/accelerator_handler.h" |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 namespace { | 102 namespace { |
| 103 | 103 |
| 104 // SetAsDefaultBrowserTask ---------------------------------------------------- |
| 105 |
| 104 class SetAsDefaultBrowserTask : public Task { | 106 class SetAsDefaultBrowserTask : public Task { |
| 105 public: | 107 public: |
| 106 SetAsDefaultBrowserTask() { } | 108 SetAsDefaultBrowserTask(); |
| 107 virtual void Run() { | 109 virtual ~SetAsDefaultBrowserTask(); |
| 108 ShellIntegration::SetAsDefaultBrowser(); | |
| 109 } | |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 virtual void Run(); |
| 113 |
| 112 DISALLOW_COPY_AND_ASSIGN(SetAsDefaultBrowserTask); | 114 DISALLOW_COPY_AND_ASSIGN(SetAsDefaultBrowserTask); |
| 113 }; | 115 }; |
| 114 | 116 |
| 117 SetAsDefaultBrowserTask::SetAsDefaultBrowserTask() { |
| 118 } |
| 119 |
| 120 SetAsDefaultBrowserTask::~SetAsDefaultBrowserTask() { |
| 121 } |
| 122 |
| 123 void SetAsDefaultBrowserTask::Run() { |
| 124 ShellIntegration::SetAsDefaultBrowser(); |
| 125 } |
| 126 |
| 127 |
| 128 // DefaultBrowserInfoBarDelegate ---------------------------------------------- |
| 129 |
| 115 // The delegate for the infobar shown when Chrome is not the default browser. | 130 // The delegate for the infobar shown when Chrome is not the default browser. |
| 116 class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { | 131 class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 117 public: | 132 public: |
| 118 explicit DefaultBrowserInfoBarDelegate(TabContents* contents) | 133 explicit DefaultBrowserInfoBarDelegate(TabContents* contents); |
| 119 : ConfirmInfoBarDelegate(contents), | |
| 120 profile_(contents->profile()), | |
| 121 action_taken_(false), | |
| 122 should_expire_(false), | |
| 123 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | |
| 124 // We want the info-bar to stick-around for few seconds and then be hidden | |
| 125 // on the next navigation after that. | |
| 126 MessageLoop::current()->PostDelayedTask(FROM_HERE, | |
| 127 method_factory_.NewRunnableMethod( | |
| 128 &DefaultBrowserInfoBarDelegate::Expire), | |
| 129 8000); // 8 seconds. | |
| 130 } | |
| 131 | 134 |
| 135 private: |
| 136 virtual ~DefaultBrowserInfoBarDelegate(); |
| 137 |
| 138 void AllowExpiry() { should_expire_ = true; } |
| 139 |
| 140 // ConfirmInfoBarDelegate: |
| 132 virtual bool ShouldExpire( | 141 virtual bool ShouldExpire( |
| 133 const NavigationController::LoadCommittedDetails& details) const { | 142 const NavigationController::LoadCommittedDetails& details) const; |
| 134 return should_expire_; | 143 virtual void InfoBarClosed(); |
| 135 } | 144 virtual SkBitmap* GetIcon() const; |
| 136 | 145 virtual string16 GetMessageText() const; |
| 137 // Overridden from ConfirmInfoBarDelegate: | 146 virtual int GetButtons() const; |
| 138 virtual void InfoBarClosed() { | 147 virtual string16 GetButtonLabel(InfoBarButton button) const; |
| 139 if (!action_taken_) | 148 virtual bool NeedElevation(InfoBarButton button) const; |
| 140 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); | 149 virtual bool Accept(); |
| 141 delete this; | 150 virtual bool Cancel(); |
| 142 } | |
| 143 | |
| 144 virtual string16 GetMessageText() const { | |
| 145 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); | |
| 146 } | |
| 147 | |
| 148 virtual SkBitmap* GetIcon() const { | |
| 149 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
| 150 IDR_PRODUCT_ICON_32); | |
| 151 } | |
| 152 | |
| 153 virtual int GetButtons() const { | |
| 154 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; | |
| 155 } | |
| 156 | |
| 157 virtual string16 GetButtonLabel(InfoBarButton button) const { | |
| 158 return button == BUTTON_OK ? | |
| 159 l10n_util::GetStringUTF16(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) : | |
| 160 l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); | |
| 161 } | |
| 162 | |
| 163 virtual bool NeedElevation(InfoBarButton button) const { | |
| 164 return button == BUTTON_OK; | |
| 165 } | |
| 166 | |
| 167 virtual bool Accept() { | |
| 168 action_taken_ = true; | |
| 169 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); | |
| 170 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | |
| 171 new SetAsDefaultBrowserTask()); | |
| 172 return true; | |
| 173 } | |
| 174 | |
| 175 virtual bool Cancel() { | |
| 176 action_taken_ = true; | |
| 177 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); | |
| 178 // User clicked "Don't ask me again", remember that. | |
| 179 profile_->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, false); | |
| 180 return true; | |
| 181 } | |
| 182 | |
| 183 void Expire() { | |
| 184 should_expire_ = true; | |
| 185 } | |
| 186 | 151 |
| 187 private: | 152 private: |
| 188 // The Profile that we restore sessions from. | 153 // The Profile that we restore sessions from. |
| 189 Profile* profile_; | 154 Profile* profile_; |
| 190 | 155 |
| 191 // Whether the user clicked one of the buttons. | 156 // Whether the user clicked one of the buttons. |
| 192 bool action_taken_; | 157 bool action_taken_; |
| 193 | 158 |
| 194 // Whether the info-bar should be dismissed on the next navigation. | 159 // Whether the info-bar should be dismissed on the next navigation. |
| 195 bool should_expire_; | 160 bool should_expire_; |
| 196 | 161 |
| 197 // Used to delay the expiration of the info-bar. | 162 // Used to delay the expiration of the info-bar. |
| 198 ScopedRunnableMethodFactory<DefaultBrowserInfoBarDelegate> method_factory_; | 163 ScopedRunnableMethodFactory<DefaultBrowserInfoBarDelegate> method_factory_; |
| 199 | 164 |
| 200 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); | 165 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); |
| 201 }; | 166 }; |
| 202 | 167 |
| 168 DefaultBrowserInfoBarDelegate::DefaultBrowserInfoBarDelegate( |
| 169 TabContents* contents) |
| 170 : ConfirmInfoBarDelegate(contents), |
| 171 profile_(contents->profile()), |
| 172 action_taken_(false), |
| 173 should_expire_(false), |
| 174 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 175 // We want the info-bar to stick-around for few seconds and then be hidden |
| 176 // on the next navigation after that. |
| 177 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 178 method_factory_.NewRunnableMethod( |
| 179 &DefaultBrowserInfoBarDelegate::AllowExpiry), 8000); // 8 seconds. |
| 180 } |
| 181 |
| 182 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { |
| 183 } |
| 184 |
| 185 bool DefaultBrowserInfoBarDelegate::ShouldExpire( |
| 186 const NavigationController::LoadCommittedDetails& details) const { |
| 187 return should_expire_; |
| 188 } |
| 189 |
| 190 void DefaultBrowserInfoBarDelegate::InfoBarClosed() { |
| 191 if (!action_taken_) |
| 192 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); |
| 193 delete this; |
| 194 } |
| 195 |
| 196 SkBitmap* DefaultBrowserInfoBarDelegate::GetIcon() const { |
| 197 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 198 IDR_PRODUCT_ICON_32); |
| 199 } |
| 200 |
| 201 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { |
| 202 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); |
| 203 } |
| 204 |
| 205 int DefaultBrowserInfoBarDelegate::GetButtons() const { |
| 206 return BUTTON_OK | BUTTON_CANCEL; |
| 207 } |
| 208 |
| 209 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( |
| 210 InfoBarButton button) const { |
| 211 return button == BUTTON_OK ? |
| 212 l10n_util::GetStringUTF16(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) : |
| 213 l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); |
| 214 } |
| 215 |
| 216 bool DefaultBrowserInfoBarDelegate::NeedElevation(InfoBarButton button) const { |
| 217 return button == BUTTON_OK; |
| 218 } |
| 219 |
| 220 bool DefaultBrowserInfoBarDelegate::Accept() { |
| 221 action_taken_ = true; |
| 222 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); |
| 223 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
| 224 new SetAsDefaultBrowserTask()); |
| 225 return true; |
| 226 } |
| 227 |
| 228 bool DefaultBrowserInfoBarDelegate::Cancel() { |
| 229 action_taken_ = true; |
| 230 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); |
| 231 // User clicked "Don't ask me again", remember that. |
| 232 profile_->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, false); |
| 233 return true; |
| 234 } |
| 235 |
| 236 |
| 237 // NotifyNotDefaultBrowserTask ------------------------------------------------ |
| 238 |
| 203 class NotifyNotDefaultBrowserTask : public Task { | 239 class NotifyNotDefaultBrowserTask : public Task { |
| 204 public: | 240 public: |
| 205 NotifyNotDefaultBrowserTask() { } | 241 NotifyNotDefaultBrowserTask(); |
| 206 | 242 virtual ~NotifyNotDefaultBrowserTask(); |
| 207 virtual void Run() { | |
| 208 Browser* browser = BrowserList::GetLastActive(); | |
| 209 if (!browser) { | |
| 210 // Reached during ui tests. | |
| 211 return; | |
| 212 } | |
| 213 TabContents* tab = browser->GetSelectedTabContents(); | |
| 214 // Don't show the info-bar if there are already info-bars showing. | |
| 215 // In ChromeBot tests, there might be a race. This line appears to get | |
| 216 // called during shutdown and |tab| can be NULL. | |
| 217 if (!tab || tab->infobar_delegate_count() > 0) | |
| 218 return; | |
| 219 tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab)); | |
| 220 } | |
| 221 | 243 |
| 222 private: | 244 private: |
| 245 virtual void Run(); |
| 246 |
| 223 DISALLOW_COPY_AND_ASSIGN(NotifyNotDefaultBrowserTask); | 247 DISALLOW_COPY_AND_ASSIGN(NotifyNotDefaultBrowserTask); |
| 224 }; | 248 }; |
| 225 | 249 |
| 250 NotifyNotDefaultBrowserTask::NotifyNotDefaultBrowserTask() { |
| 251 } |
| 252 |
| 253 NotifyNotDefaultBrowserTask::~NotifyNotDefaultBrowserTask() { |
| 254 } |
| 255 |
| 256 void NotifyNotDefaultBrowserTask::Run() { |
| 257 Browser* browser = BrowserList::GetLastActive(); |
| 258 if (!browser) |
| 259 return; // Reached during ui tests. |
| 260 // Don't show the info-bar if there are already info-bars showing. |
| 261 // In ChromeBot tests, there might be a race. This line appears to get |
| 262 // called during shutdown and |tab| can be NULL. |
| 263 TabContents* tab = browser->GetSelectedTabContents(); |
| 264 if (!tab || tab->infobar_delegate_count() > 0) |
| 265 return; |
| 266 tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab)); |
| 267 } |
| 268 |
| 269 |
| 270 // CheckDefaultBrowserTask ---------------------------------------------------- |
| 271 |
| 226 class CheckDefaultBrowserTask : public Task { | 272 class CheckDefaultBrowserTask : public Task { |
| 227 public: | 273 public: |
| 228 CheckDefaultBrowserTask() { | 274 CheckDefaultBrowserTask(); |
| 229 } | 275 virtual ~CheckDefaultBrowserTask(); |
| 230 | 276 |
| 231 virtual void Run() { | 277 private: |
| 232 if (ShellIntegration::IsDefaultBrowser()) | 278 virtual void Run(); |
| 233 return; | 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserTask); |
| 281 }; |
| 282 |
| 283 CheckDefaultBrowserTask::CheckDefaultBrowserTask() { |
| 284 } |
| 285 |
| 286 CheckDefaultBrowserTask::~CheckDefaultBrowserTask() { |
| 287 } |
| 288 |
| 289 void CheckDefaultBrowserTask::Run() { |
| 290 if (ShellIntegration::IsDefaultBrowser()) |
| 291 return; |
| 234 #if defined(OS_WIN) | 292 #if defined(OS_WIN) |
| 235 if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) | 293 if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) |
| 236 return; | 294 return; |
| 237 #endif | 295 #endif |
| 238 | 296 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 239 BrowserThread::PostTask( | 297 new NotifyNotDefaultBrowserTask()); |
| 240 BrowserThread::UI, FROM_HERE, new NotifyNotDefaultBrowserTask()); | 298 } |
| 241 } | 299 |
| 242 | 300 |
| 243 private: | 301 // SessionCrashedInfoBarDelegate ---------------------------------------------- |
| 244 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserTask); | |
| 245 }; | |
| 246 | 302 |
| 247 // A delegate for the InfoBar shown when the previous session has crashed. The | 303 // A delegate for the InfoBar shown when the previous session has crashed. The |
| 248 // bar deletes itself automatically after it is closed. | 304 // bar deletes itself automatically after it is closed. |
| 249 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate { | 305 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 250 public: | 306 public: |
| 251 explicit SessionCrashedInfoBarDelegate(TabContents* contents) | 307 explicit SessionCrashedInfoBarDelegate(TabContents* contents); |
| 252 : ConfirmInfoBarDelegate(contents), | |
| 253 profile_(contents->profile()) { | |
| 254 } | |
| 255 | |
| 256 // Overridden from ConfirmInfoBarDelegate: | |
| 257 virtual void InfoBarClosed() { | |
| 258 delete this; | |
| 259 } | |
| 260 virtual string16 GetMessageText() const { | |
| 261 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_MESSAGE); | |
| 262 } | |
| 263 virtual SkBitmap* GetIcon() const { | |
| 264 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
| 265 IDR_INFOBAR_RESTORE_SESSION); | |
| 266 } | |
| 267 virtual int GetButtons() const { return BUTTON_OK; } | |
| 268 virtual string16 GetButtonLabel(InfoBarButton button) const { | |
| 269 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); | |
| 270 } | |
| 271 virtual bool Accept() { | |
| 272 // Restore the session. | |
| 273 SessionRestore::RestoreSession(profile_, NULL, true, false, | |
| 274 std::vector<GURL>()); | |
| 275 return true; | |
| 276 } | |
| 277 | 308 |
| 278 private: | 309 private: |
| 310 virtual ~SessionCrashedInfoBarDelegate(); |
| 311 |
| 312 // ConfirmInfoBarDelegate: |
| 313 virtual void InfoBarClosed(); |
| 314 virtual SkBitmap* GetIcon() const; |
| 315 virtual string16 GetMessageText() const; |
| 316 virtual int GetButtons() const; |
| 317 virtual string16 GetButtonLabel(InfoBarButton button) const; |
| 318 virtual bool Accept(); |
| 319 |
| 279 // The Profile that we restore sessions from. | 320 // The Profile that we restore sessions from. |
| 280 Profile* profile_; | 321 Profile* profile_; |
| 281 | 322 |
| 282 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate); | 323 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate); |
| 283 }; | 324 }; |
| 284 | 325 |
| 326 SessionCrashedInfoBarDelegate::SessionCrashedInfoBarDelegate( |
| 327 TabContents* contents) |
| 328 : ConfirmInfoBarDelegate(contents), |
| 329 profile_(contents->profile()) { |
| 330 } |
| 331 |
| 332 SessionCrashedInfoBarDelegate::~SessionCrashedInfoBarDelegate() { |
| 333 } |
| 334 |
| 335 void SessionCrashedInfoBarDelegate::InfoBarClosed() { |
| 336 delete this; |
| 337 } |
| 338 |
| 339 SkBitmap* SessionCrashedInfoBarDelegate::GetIcon() const { |
| 340 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 341 IDR_INFOBAR_RESTORE_SESSION); |
| 342 } |
| 343 |
| 344 string16 SessionCrashedInfoBarDelegate::GetMessageText() const { |
| 345 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_MESSAGE); |
| 346 } |
| 347 |
| 348 int SessionCrashedInfoBarDelegate::GetButtons() const { |
| 349 return BUTTON_OK; |
| 350 } |
| 351 |
| 352 string16 SessionCrashedInfoBarDelegate::GetButtonLabel( |
| 353 InfoBarButton button) const { |
| 354 DCHECK_EQ(BUTTON_OK, button); |
| 355 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); |
| 356 } |
| 357 |
| 358 bool SessionCrashedInfoBarDelegate::Accept() { |
| 359 SessionRestore::RestoreSession(profile_, NULL, true, false, |
| 360 std::vector<GURL>()); |
| 361 return true; |
| 362 } |
| 363 |
| 364 |
| 365 // Utility functions ---------------------------------------------------------- |
| 366 |
| 285 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, | 367 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, |
| 286 Profile* profile) { | 368 Profile* profile) { |
| 287 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); | 369 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); |
| 288 if (command_line.HasSwitch(switches::kRestoreLastSession)) | 370 if (command_line.HasSwitch(switches::kRestoreLastSession)) |
| 289 pref.type = SessionStartupPref::LAST; | 371 pref.type = SessionStartupPref::LAST; |
| 290 if (command_line.HasSwitch(switches::kIncognito) && | 372 if (command_line.HasSwitch(switches::kIncognito) && |
| 291 pref.type == SessionStartupPref::LAST) { | 373 pref.type == SessionStartupPref::LAST) { |
| 292 // We don't store session information when incognito. If the user has | 374 // We don't store session information when incognito. If the user has |
| 293 // chosen to restore last session and launched incognito, fallback to | 375 // chosen to restore last session and launched incognito, fallback to |
| 294 // default launch behavior. | 376 // default launch behavior. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 for (size_t i = 0; i < urls.size(); ++i) { | 442 for (size_t i = 0; i < urls.size(); ++i) { |
| 361 BrowserInit::LaunchWithProfile::Tab tab; | 443 BrowserInit::LaunchWithProfile::Tab tab; |
| 362 tab.is_pinned = false; | 444 tab.is_pinned = false; |
| 363 tab.url = urls[i]; | 445 tab.url = urls[i]; |
| 364 tabs->push_back(tab); | 446 tabs->push_back(tab); |
| 365 } | 447 } |
| 366 } | 448 } |
| 367 | 449 |
| 368 } // namespace | 450 } // namespace |
| 369 | 451 |
| 452 |
| 453 // BrowserInit ---------------------------------------------------------------- |
| 454 |
| 370 BrowserInit::BrowserInit() {} | 455 BrowserInit::BrowserInit() {} |
| 371 | 456 |
| 372 BrowserInit::~BrowserInit() {} | 457 BrowserInit::~BrowserInit() {} |
| 373 | 458 |
| 374 void BrowserInit::AddFirstRunTab(const GURL& url) { | 459 void BrowserInit::AddFirstRunTab(const GURL& url) { |
| 375 first_run_tabs_.push_back(url); | 460 first_run_tabs_.push_back(url); |
| 376 } | 461 } |
| 377 | 462 |
| 378 // static | 463 // static |
| 379 bool BrowserInit::InProcessStartup() { | 464 bool BrowserInit::InProcessStartup() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 new chromeos::BrightnessObserver(); | 550 new chromeos::BrightnessObserver(); |
| 466 chromeos::CrosLibrary::Get()->GetBrightnessLibrary() | 551 chromeos::CrosLibrary::Get()->GetBrightnessLibrary() |
| 467 ->AddObserver(brightness_observer); | 552 ->AddObserver(brightness_observer); |
| 468 | 553 |
| 469 profile->SetupChromeOSEnterpriseExtensionObserver(); | 554 profile->SetupChromeOSEnterpriseExtensionObserver(); |
| 470 } | 555 } |
| 471 #endif | 556 #endif |
| 472 return true; | 557 return true; |
| 473 } | 558 } |
| 474 | 559 |
| 475 // Tab ------------------------------------------------------------------------ | 560 |
| 561 // BrowserInit::LaunchWithProfile::Tab ---------------------------------------- |
| 476 | 562 |
| 477 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} | 563 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} |
| 478 | 564 |
| 479 BrowserInit::LaunchWithProfile::Tab::~Tab() {} | 565 BrowserInit::LaunchWithProfile::Tab::~Tab() {} |
| 480 | 566 |
| 481 // LaunchWithProfile ---------------------------------------------------------- | 567 |
| 568 // BrowserInit::LaunchWithProfile --------------------------------------------- |
| 482 | 569 |
| 483 BrowserInit::LaunchWithProfile::LaunchWithProfile( | 570 BrowserInit::LaunchWithProfile::LaunchWithProfile( |
| 484 const FilePath& cur_dir, | 571 const FilePath& cur_dir, |
| 485 const CommandLine& command_line) | 572 const CommandLine& command_line) |
| 486 : cur_dir_(cur_dir), | 573 : cur_dir_(cur_dir), |
| 487 command_line_(command_line), | 574 command_line_(command_line), |
| 488 profile_(NULL), | 575 profile_(NULL), |
| 489 browser_init_(NULL) { | 576 browser_init_(NULL) { |
| 490 } | 577 } |
| 491 | 578 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 939 |
| 853 const char* bad_flag = NULL; | 940 const char* bad_flag = NULL; |
| 854 for (const char** flag = kBadFlags; *flag; ++flag) { | 941 for (const char** flag = kBadFlags; *flag; ++flag) { |
| 855 if (command_line_.HasSwitch(*flag)) { | 942 if (command_line_.HasSwitch(*flag)) { |
| 856 bad_flag = *flag; | 943 bad_flag = *flag; |
| 857 break; | 944 break; |
| 858 } | 945 } |
| 859 } | 946 } |
| 860 | 947 |
| 861 if (bad_flag) { | 948 if (bad_flag) { |
| 862 tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab, | 949 tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab, NULL, |
| 863 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, | 950 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, |
| 864 UTF8ToUTF16(std::string("--") + bad_flag)), | 951 UTF8ToUTF16(std::string("--") + bad_flag)), |
| 865 NULL, false)); | 952 false)); |
| 866 } | 953 } |
| 867 } | 954 } |
| 868 | 955 |
| 869 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( | 956 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( |
| 870 Profile* profile) { | 957 Profile* profile) { |
| 871 std::vector<GURL> urls; | 958 std::vector<GURL> urls; |
| 872 const std::vector<CommandLine::StringType>& params = command_line_.args(); | 959 const std::vector<CommandLine::StringType>& params = command_line_.args(); |
| 873 | 960 |
| 874 for (size_t i = 0; i < params.size(); ++i) { | 961 for (size_t i = 0; i < params.size(); ++i) { |
| 875 FilePath param = FilePath(params[i]); | 962 FilePath param = FilePath(params[i]); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 return false; | 1183 return false; |
| 1097 automation->SetExpectedTabCount(expected_tabs); | 1184 automation->SetExpectedTabCount(expected_tabs); |
| 1098 | 1185 |
| 1099 AutomationProviderList* list = | 1186 AutomationProviderList* list = |
| 1100 g_browser_process->InitAutomationProviderList(); | 1187 g_browser_process->InitAutomationProviderList(); |
| 1101 DCHECK(list); | 1188 DCHECK(list); |
| 1102 list->AddProvider(automation); | 1189 list->AddProvider(automation); |
| 1103 | 1190 |
| 1104 return true; | 1191 return true; |
| 1105 } | 1192 } |
| OLD | NEW |