| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 WebContents* web_contents = | 176 WebContents* web_contents = |
| 177 browser->tab_strip_model()->GetActiveWebContents(); | 177 browser->tab_strip_model()->GetActiveWebContents(); |
| 178 GetURLAndTitleToBookmark(web_contents, &url, &title); | 178 GetURLAndTitleToBookmark(web_contents, &url, &title); |
| 179 bool is_bookmarked_by_any = model->IsBookmarked(url); | 179 bool is_bookmarked_by_any = model->IsBookmarked(url); |
| 180 if (!is_bookmarked_by_any && | 180 if (!is_bookmarked_by_any && |
| 181 web_contents->GetBrowserContext()->IsOffTheRecord()) { | 181 web_contents->GetBrowserContext()->IsOffTheRecord()) { |
| 182 // If we're incognito the favicon may not have been saved. Save it now | 182 // If we're incognito the favicon may not have been saved. Save it now |
| 183 // so that bookmarks have an icon for the page. | 183 // so that bookmarks have an icon for the page. |
| 184 FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon(); | 184 FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon(); |
| 185 } | 185 } |
| 186 bool was_bookmarked_by_user = bookmark_utils::IsBookmarkedByUser(model, url); | 186 bool was_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url); |
| 187 bookmark_utils::AddIfNotBookmarked(model, url, title); | 187 bookmarks::AddIfNotBookmarked(model, url, title); |
| 188 bool is_bookmarked_by_user = bookmark_utils::IsBookmarkedByUser(model, url); | 188 bool is_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url); |
| 189 // Make sure the model actually added a bookmark before showing the star. A | 189 // Make sure the model actually added a bookmark before showing the star. A |
| 190 // bookmark isn't created if the url is invalid. | 190 // bookmark isn't created if the url is invalid. |
| 191 if (browser->window()->IsActive() && is_bookmarked_by_user) { | 191 if (browser->window()->IsActive() && is_bookmarked_by_user) { |
| 192 // Only show the bubble if the window is active, otherwise we may get into | 192 // Only show the bubble if the window is active, otherwise we may get into |
| 193 // weird situations where the bubble is deleted as soon as it is shown. | 193 // weird situations where the bubble is deleted as soon as it is shown. |
| 194 browser->window()->ShowBookmarkBubble(url, was_bookmarked_by_user); | 194 browser->window()->ShowBookmarkBubble(url, was_bookmarked_by_user); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Based on |disposition|, creates a new tab as necessary, and returns the | 198 // Based on |disposition|, creates a new tab as necessary, and returns the |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 browser->profile(), | 1266 browser->profile(), |
| 1267 browser->host_desktop_type())); | 1267 browser->host_desktop_type())); |
| 1268 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1268 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1269 | 1269 |
| 1270 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1270 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1271 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1271 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1272 app_browser->window()->Show(); | 1272 app_browser->window()->Show(); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 } // namespace chrome | 1275 } // namespace chrome |
| OLD | NEW |