OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 BookmarkModel* model = profile()->GetBookmarkModel(); | 1557 BookmarkModel* model = profile()->GetBookmarkModel(); |
1558 if (!model || !model->IsLoaded()) | 1558 if (!model || !model->IsLoaded()) |
1559 return; // Ignore requests until bookmarks are loaded. | 1559 return; // Ignore requests until bookmarks are loaded. |
1560 | 1560 |
1561 GURL url; | 1561 GURL url; |
1562 string16 title; | 1562 string16 title; |
1563 TabContents* tab = GetSelectedTabContents(); | 1563 TabContents* tab = GetSelectedTabContents(); |
1564 bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title); | 1564 bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title); |
1565 bool was_bookmarked = model->IsBookmarked(url); | 1565 bool was_bookmarked = model->IsBookmarked(url); |
1566 if (!was_bookmarked && profile_->IsOffTheRecord()) { | 1566 if (!was_bookmarked && profile_->IsOffTheRecord()) { |
1567 // If we're off the record the favicon may not have been saved. Save it now | 1567 // If we're incognito the favicon may not have been saved. Save it now |
1568 // so that bookmarks have an icon for the page. | 1568 // so that bookmarks have an icon for the page. |
1569 tab->SaveFavicon(); | 1569 tab->SaveFavicon(); |
1570 } | 1570 } |
1571 model->SetURLStarred(url, title, true); | 1571 model->SetURLStarred(url, title, true); |
1572 // Make sure the model actually added a bookmark before showing the star. A | 1572 // Make sure the model actually added a bookmark before showing the star. A |
1573 // bookmark isn't created if the url is invalid. | 1573 // bookmark isn't created if the url is invalid. |
1574 if (window_->IsActive() && model->IsBookmarked(url)) { | 1574 if (window_->IsActive() && model->IsBookmarked(url)) { |
1575 // Only show the bubble if the window is active, otherwise we may get into | 1575 // Only show the bubble if the window is active, otherwise we may get into |
1576 // weird situations were the bubble is deleted as soon as it is shown. | 1576 // weird situations were the bubble is deleted as soon as it is shown. |
1577 window_->ShowBookmarkBubble(url, was_bookmarked); | 1577 window_->ShowBookmarkBubble(url, was_bookmarked); |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 // The page transition below is only for the purpose of inserting the tab. | 4413 // The page transition below is only for the purpose of inserting the tab. |
4414 browser->AddTab(view_source_contents, PageTransition::LINK); | 4414 browser->AddTab(view_source_contents, PageTransition::LINK); |
4415 } | 4415 } |
4416 | 4416 |
4417 if (profile_->HasSessionService()) { | 4417 if (profile_->HasSessionService()) { |
4418 SessionService* session_service = profile_->GetSessionService(); | 4418 SessionService* session_service = profile_->GetSessionService(); |
4419 if (session_service) | 4419 if (session_service) |
4420 session_service->TabRestored(&view_source_contents->controller(), false); | 4420 session_service->TabRestored(&view_source_contents->controller(), false); |
4421 } | 4421 } |
4422 } | 4422 } |
OLD | NEW |