| OLD | NEW |
| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/prefs/session_startup_pref.h" | 10 #include "chrome/browser/prefs/session_startup_pref.h" |
| 11 #include "chrome/browser/protector/base_prefs_change.h" | 11 #include "chrome/browser/protector/base_prefs_change.h" |
| 12 #include "chrome/browser/protector/histograms.h" | 12 #include "chrome/browser/protector/histograms.h" |
| 13 #include "chrome/browser/protector/protector_service.h" | 13 #include "chrome/browser/protector/protector_service.h" |
| 14 #include "chrome/browser/protector/protector_service_factory.h" | 14 #include "chrome/browser/protector/protector_service_factory.h" |
| 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_navigator.h" |
| 15 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 17 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/browser/ui/browser.h" | |
| 18 #include "chrome/browser/ui/browser_navigator.h" | |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources_standard.h" | 23 #include "grit/theme_resources_standard.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 | 25 |
| 26 namespace protector { | 26 namespace protector { |
| 27 | 27 |
| 28 // Session startup settings change tracked by Protector. | 28 // Session startup settings change tracked by Protector. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return new_urls[i]; | 202 return new_urls[i]; |
| 203 } | 203 } |
| 204 // Then fallback to the first of the current startup URLs - this means that | 204 // Then fallback to the first of the current startup URLs - this means that |
| 205 // URLs themselves haven't changed. | 205 // URLs themselves haven't changed. |
| 206 return new_urls[0]; | 206 return new_urls[0]; |
| 207 } | 207 } |
| 208 | 208 |
| 209 void SessionStartupChange::OpenPinnedTabs(Browser* browser, | 209 void SessionStartupChange::OpenPinnedTabs(Browser* browser, |
| 210 const StartupTabs& tabs) { | 210 const StartupTabs& tabs) { |
| 211 for (size_t i = 0; i < tabs.size(); ++i) { | 211 for (size_t i = 0; i < tabs.size(); ++i) { |
| 212 browser::NavigateParams params(browser, tabs[i].url, | 212 chrome::NavigateParams params(browser, tabs[i].url, |
| 213 content::PAGE_TRANSITION_START_PAGE); | 213 content::PAGE_TRANSITION_START_PAGE); |
| 214 params.disposition = NEW_BACKGROUND_TAB; | 214 params.disposition = NEW_BACKGROUND_TAB; |
| 215 params.tabstrip_index = -1; | 215 params.tabstrip_index = -1; |
| 216 params.tabstrip_add_types = TabStripModel::ADD_PINNED; | 216 params.tabstrip_add_types = TabStripModel::ADD_PINNED; |
| 217 params.extension_app_id = tabs[i].app_id; | 217 params.extension_app_id = tabs[i].app_id; |
| 218 browser::Navigate(¶ms); | 218 chrome::Navigate(¶ms); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 BaseSettingChange* CreateSessionStartupChange( | 222 BaseSettingChange* CreateSessionStartupChange( |
| 223 const SessionStartupPref& actual_startup_pref, | 223 const SessionStartupPref& actual_startup_pref, |
| 224 const StartupTabs& actual_pinned_tabs, | 224 const StartupTabs& actual_pinned_tabs, |
| 225 const SessionStartupPref& backup_startup_pref, | 225 const SessionStartupPref& backup_startup_pref, |
| 226 const StartupTabs& backup_pinned_tabs) { | 226 const StartupTabs& backup_pinned_tabs) { |
| 227 return new SessionStartupChange(actual_startup_pref, actual_pinned_tabs, | 227 return new SessionStartupChange(actual_startup_pref, actual_pinned_tabs, |
| 228 backup_startup_pref, backup_pinned_tabs); | 228 backup_startup_pref, backup_pinned_tabs); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace protector | 231 } // namespace protector |
| OLD | NEW |