OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 | 1498 |
1499 void Browser::BookmarkCurrentPage() { | 1499 void Browser::BookmarkCurrentPage() { |
1500 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); | 1500 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); |
1501 | 1501 |
1502 BookmarkModel* model = profile()->GetBookmarkModel(); | 1502 BookmarkModel* model = profile()->GetBookmarkModel(); |
1503 if (!model || !model->IsLoaded()) | 1503 if (!model || !model->IsLoaded()) |
1504 return; // Ignore requests until bookmarks are loaded. | 1504 return; // Ignore requests until bookmarks are loaded. |
1505 | 1505 |
1506 GURL url; | 1506 GURL url; |
1507 string16 title; | 1507 string16 title; |
1508 bookmark_utils::GetURLAndTitleToBookmark(GetSelectedTabContents(), &url, | 1508 TabContents* tab = GetSelectedTabContents(); |
1509 &title); | 1509 bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title); |
1510 bool was_bookmarked = model->IsBookmarked(url); | 1510 bool was_bookmarked = model->IsBookmarked(url); |
| 1511 if (!was_bookmarked && profile_->IsOffTheRecord()) { |
| 1512 // If we're off the record the favicon may not have been saved. Save it now |
| 1513 // so that bookmarks have an icon for the page. |
| 1514 tab->SaveFavicon(); |
| 1515 } |
1511 model->SetURLStarred(url, title, true); | 1516 model->SetURLStarred(url, title, true); |
1512 // Make sure the model actually added a bookmark before showing the star. A | 1517 // Make sure the model actually added a bookmark before showing the star. A |
1513 // bookmark isn't created if the url is invalid. | 1518 // bookmark isn't created if the url is invalid. |
1514 if (window_->IsActive() && model->IsBookmarked(url)) { | 1519 if (window_->IsActive() && model->IsBookmarked(url)) { |
1515 // Only show the bubble if the window is active, otherwise we may get into | 1520 // Only show the bubble if the window is active, otherwise we may get into |
1516 // weird situations were the bubble is deleted as soon as it is shown. | 1521 // weird situations were the bubble is deleted as soon as it is shown. |
1517 window_->ShowBookmarkBubble(url, was_bookmarked); | 1522 window_->ShowBookmarkBubble(url, was_bookmarked); |
1518 } | 1523 } |
1519 } | 1524 } |
1520 | 1525 |
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4159 return false; | 4164 return false; |
4160 } | 4165 } |
4161 | 4166 |
4162 void Browser::CreateInstantIfNecessary() { | 4167 void Browser::CreateInstantIfNecessary() { |
4163 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4168 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
4164 !profile()->IsOffTheRecord()) { | 4169 !profile()->IsOffTheRecord()) { |
4165 instant_.reset(new InstantController(profile_, this)); | 4170 instant_.reset(new InstantController(profile_, this)); |
4166 instant_unload_handler_.reset(new InstantUnloadHandler(this)); | 4171 instant_unload_handler_.reset(new InstantUnloadHandler(this)); |
4167 } | 4172 } |
4168 } | 4173 } |
OLD | NEW |