| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/toolbar/home_button.h" | 5 #include "chrome/browser/ui/views/toolbar/home_button.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 15 #include "components/user_prefs/user_prefs.h" | 16 #include "components/user_prefs/user_prefs.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/views/bubble/bubble_dialog_delegate.h" | 18 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 18 #include "ui/views/controls/styled_label.h" | 19 #include "ui/views/controls/styled_label.h" |
| 19 #include "ui/views/controls/styled_label_listener.h" | 20 #include "ui/views/controls/styled_label_listener.h" |
| 20 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 80 |
| 80 HomePageUndoBubble::HomePageUndoBubble( | 81 HomePageUndoBubble::HomePageUndoBubble( |
| 81 Browser* browser, | 82 Browser* browser, |
| 82 bool undo_value_is_ntp, | 83 bool undo_value_is_ntp, |
| 83 const GURL& undo_url, | 84 const GURL& undo_url, |
| 84 views::View* anchor_view) | 85 views::View* anchor_view) |
| 85 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 86 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
| 86 browser_(browser), | 87 browser_(browser), |
| 87 undo_value_is_ntp_(undo_value_is_ntp), | 88 undo_value_is_ntp_(undo_value_is_ntp), |
| 88 undo_url_(undo_url) { | 89 undo_url_(undo_url) { |
| 90 chrome::RecordDialogCreation(chrome::DialogIdentifier::HOME_PAGE_UNDO); |
| 89 } | 91 } |
| 90 | 92 |
| 91 HomePageUndoBubble::~HomePageUndoBubble() { | 93 HomePageUndoBubble::~HomePageUndoBubble() { |
| 92 } | 94 } |
| 93 | 95 |
| 94 int HomePageUndoBubble::GetDialogButtons() const { | 96 int HomePageUndoBubble::GetDialogButtons() const { |
| 95 return ui::DIALOG_BUTTON_NONE; | 97 return ui::DIALOG_BUTTON_NONE; |
| 96 } | 98 } |
| 97 | 99 |
| 98 void HomePageUndoBubble::Init() { | 100 void HomePageUndoBubble::Init() { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); | 178 bool old_is_ntp = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); |
| 177 GURL old_homepage(prefs->GetString(prefs::kHomePage)); | 179 GURL old_homepage(prefs->GetString(prefs::kHomePage)); |
| 178 | 180 |
| 179 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false); | 181 prefs->SetBoolean(prefs::kHomePageIsNewTabPage, false); |
| 180 prefs->SetString(prefs::kHomePage, new_homepage_url.spec()); | 182 prefs->SetString(prefs::kHomePage, new_homepage_url.spec()); |
| 181 | 183 |
| 182 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this); | 184 HomePageUndoBubble::ShowBubble(browser_, old_is_ntp, old_homepage, this); |
| 183 } | 185 } |
| 184 return ui::DragDropTypes::DRAG_NONE; | 186 return ui::DragDropTypes::DRAG_NONE; |
| 185 } | 187 } |
| OLD | NEW |