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/browser.h" | 5 #include "chrome/browser/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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 } | 1484 } |
1485 | 1485 |
1486 void Browser::BookmarkCurrentPage() { | 1486 void Browser::BookmarkCurrentPage() { |
1487 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); | 1487 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); |
1488 | 1488 |
1489 BookmarkModel* model = profile()->GetBookmarkModel(); | 1489 BookmarkModel* model = profile()->GetBookmarkModel(); |
1490 if (!model || !model->IsLoaded()) | 1490 if (!model || !model->IsLoaded()) |
1491 return; // Ignore requests until bookmarks are loaded. | 1491 return; // Ignore requests until bookmarks are loaded. |
1492 | 1492 |
1493 GURL url; | 1493 GURL url; |
1494 std::wstring title; | 1494 string16 title; |
1495 bookmark_utils::GetURLAndTitleToBookmark(GetSelectedTabContents(), &url, | 1495 bookmark_utils::GetURLAndTitleToBookmark(GetSelectedTabContents(), &url, |
1496 &title); | 1496 &title); |
1497 bool was_bookmarked = model->IsBookmarked(url); | 1497 bool was_bookmarked = model->IsBookmarked(url); |
1498 model->SetURLStarred(url, WideToUTF16Hack(title), true); | 1498 model->SetURLStarred(url, title, true); |
1499 // Make sure the model actually added a bookmark before showing the star. A | 1499 // Make sure the model actually added a bookmark before showing the star. A |
1500 // bookmark isn't created if the url is invalid. | 1500 // bookmark isn't created if the url is invalid. |
1501 if (window_->IsActive() && model->IsBookmarked(url)) { | 1501 if (window_->IsActive() && model->IsBookmarked(url)) { |
1502 // Only show the bubble if the window is active, otherwise we may get into | 1502 // Only show the bubble if the window is active, otherwise we may get into |
1503 // weird situations were the bubble is deleted as soon as it is shown. | 1503 // weird situations were the bubble is deleted as soon as it is shown. |
1504 window_->ShowBookmarkBubble(url, was_bookmarked); | 1504 window_->ShowBookmarkBubble(url, was_bookmarked); |
1505 } | 1505 } |
1506 } | 1506 } |
1507 | 1507 |
1508 void Browser::SavePage() { | 1508 void Browser::SavePage() { |
(...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 } | 4050 } |
4051 | 4051 |
4052 bool Browser::IsPinned(TabContents* source) { | 4052 bool Browser::IsPinned(TabContents* source) { |
4053 int index = tabstrip_model_.GetIndexOfTabContents(source); | 4053 int index = tabstrip_model_.GetIndexOfTabContents(source); |
4054 if (index == TabStripModel::kNoTab) { | 4054 if (index == TabStripModel::kNoTab) { |
4055 NOTREACHED() << "IsPinned called for tab not in our strip"; | 4055 NOTREACHED() << "IsPinned called for tab not in our strip"; |
4056 return false; | 4056 return false; |
4057 } | 4057 } |
4058 return tabstrip_model_.IsTabPinned(index); | 4058 return tabstrip_model_.IsTabPinned(index); |
4059 } | 4059 } |
OLD | NEW |