OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (!model || !model->IsLoaded()) | 731 if (!model || !model->IsLoaded()) |
732 return; // Ignore requests until bookmarks are loaded. | 732 return; // Ignore requests until bookmarks are loaded. |
733 | 733 |
734 NavigationEntry* entry = contents->controller()->GetActiveEntry(); | 734 NavigationEntry* entry = contents->controller()->GetActiveEntry(); |
735 if (!entry) | 735 if (!entry) |
736 return; // Can't star if there is no URL. | 736 return; // Can't star if there is no URL. |
737 const GURL& url = entry->display_url(); | 737 const GURL& url = entry->display_url(); |
738 if (url.is_empty() || !url.is_valid()) | 738 if (url.is_empty() || !url.is_valid()) |
739 return; | 739 return; |
740 | 740 |
| 741 bool was_bookmarked = model->IsBookmarked(url); |
741 model->SetURLStarred(url, entry->title(), true); | 742 model->SetURLStarred(url, entry->title(), true); |
742 if (window_->IsActive()) { | 743 if (window_->IsActive()) { |
743 // Only show the bubble if the window is active, otherwise we may get into | 744 // Only show the bubble if the window is active, otherwise we may get into |
744 // weird situations were the bubble is deleted as soon as it is shown. | 745 // weird situations were the bubble is deleted as soon as it is shown. |
745 window_->ShowBookmarkBubble(url, model->IsBookmarked(url)); | 746 window_->ShowBookmarkBubble(url, was_bookmarked); |
746 } | 747 } |
747 } | 748 } |
748 | 749 |
749 void Browser::SavePage() { | 750 void Browser::SavePage() { |
750 UserMetrics::RecordAction(L"SavePage", profile_); | 751 UserMetrics::RecordAction(L"SavePage", profile_); |
751 GetSelectedTabContents()->AsWebContents()->OnSavePage(); | 752 GetSelectedTabContents()->AsWebContents()->OnSavePage(); |
752 } | 753 } |
753 | 754 |
754 void Browser::ViewSource() { | 755 void Browser::ViewSource() { |
755 UserMetrics::RecordAction(L"ViewSource", profile_); | 756 UserMetrics::RecordAction(L"ViewSource", profile_); |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2438 | 2439 |
2439 // We need to register the window position pref. | 2440 // We need to register the window position pref. |
2440 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2441 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2441 window_pref.append(L"_"); | 2442 window_pref.append(L"_"); |
2442 window_pref.append(app_name); | 2443 window_pref.append(app_name); |
2443 PrefService* prefs = g_browser_process->local_state(); | 2444 PrefService* prefs = g_browser_process->local_state(); |
2444 DCHECK(prefs); | 2445 DCHECK(prefs); |
2445 | 2446 |
2446 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2447 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2447 } | 2448 } |
OLD | NEW |