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 "chrome/browser/ui/views/home_button.h" | 5 #include "chrome/browser/ui/views/home_button.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 layout->StartRow(0, 1); | 107 layout->StartRow(0, 1); |
108 layout->AddView(message_label); | 108 layout->AddView(message_label); |
109 | 109 |
110 views::Link* undo_link = new views::Link( | 110 views::Link* undo_link = new views::Link( |
111 l10n_util::GetStringUTF16(IDS_ONE_CLICK_BUBBLE_UNDO)); | 111 l10n_util::GetStringUTF16(IDS_ONE_CLICK_BUBBLE_UNDO)); |
112 undo_link->set_listener(this); | 112 undo_link->set_listener(this); |
113 layout->AddView(undo_link); | 113 layout->AddView(undo_link); |
114 } | 114 } |
115 | 115 |
116 void HomePageUndoBubble::LinkClicked(views::Link* source, int event_flags) { | 116 void HomePageUndoBubble::LinkClicked(views::Link* source, int event_flags) { |
117 PrefService* prefs = components::UserPrefs::Get(browser_->profile()); | 117 PrefService* prefs = user_prefs::UserPrefs::Get(browser_->profile()); |
118 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, undo_value_is_ntp_); | 118 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, undo_value_is_ntp_); |
119 prefs->SetString(prefs::kHomePage, undo_url_.spec()); | 119 prefs->SetString(prefs::kHomePage, undo_url_.spec()); |
120 | 120 |
121 HideBubble(); | 121 HideBubble(); |
122 } | 122 } |
123 | 123 |
124 void HomePageUndoBubble::WindowClosing() { | 124 void HomePageUndoBubble::WindowClosing() { |
125 // We have to reset |home_page_undo_bubble_| here, not in our destructor, | 125 // We have to reset |home_page_undo_bubble_| here, not in our destructor, |
126 // because we'll be hidden first, then destroyed asynchronously. If we wait | 126 // because we'll be hidden first, then destroyed asynchronously. If we wait |
127 // to reset this, and the user triggers a call to ShowBubble() while the | 127 // to reset this, and the user triggers a call to ShowBubble() while the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); | 171 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); |
172 GURL old_homepage(prefs->GetString(prefs::kHomePage)); | 172 GURL old_homepage(prefs->GetString(prefs::kHomePage)); |
173 | 173 |
174 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false); | 174 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false); |
175 prefs->SetString(prefs::kHomePage, new_homepage_url.spec()); | 175 prefs->SetString(prefs::kHomePage, new_homepage_url.spec()); |
176 | 176 |
177 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this); | 177 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this); |
178 } | 178 } |
179 return ui::DragDropTypes::DRAG_NONE; | 179 return ui::DragDropTypes::DRAG_NONE; |
180 } | 180 } |
OLD | NEW |