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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 base::string16 title; | 174 base::string16 title; |
175 WebContents* web_contents = | 175 WebContents* web_contents = |
176 browser->tab_strip_model()->GetActiveWebContents(); | 176 browser->tab_strip_model()->GetActiveWebContents(); |
177 GetURLAndTitleToBookmark(web_contents, &url, &title); | 177 GetURLAndTitleToBookmark(web_contents, &url, &title); |
178 bool was_bookmarked = model->IsBookmarked(url); | 178 bool was_bookmarked = model->IsBookmarked(url); |
179 if (!was_bookmarked && web_contents->GetBrowserContext()->IsOffTheRecord()) { | 179 if (!was_bookmarked && web_contents->GetBrowserContext()->IsOffTheRecord()) { |
180 // If we're incognito the favicon may not have been saved. Save it now | 180 // If we're incognito the favicon may not have been saved. Save it now |
181 // so that bookmarks have an icon for the page. | 181 // so that bookmarks have an icon for the page. |
182 FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon(); | 182 FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon(); |
183 } | 183 } |
184 bookmark_utils::AddIfNotBookmarked(model, url, title); | 184 bookmark_utils::AddIfNotBookmarked(model, model, url, title); |
185 if (from_star && !was_bookmarked) | 185 if (from_star && !was_bookmarked) |
186 BookmarkPromptController::AddedBookmark(browser, url); | 186 BookmarkPromptController::AddedBookmark(browser, url); |
187 // Make sure the model actually added a bookmark before showing the star. A | 187 // Make sure the model actually added a bookmark before showing the star. A |
188 // bookmark isn't created if the url is invalid. | 188 // bookmark isn't created if the url is invalid. |
189 if (browser->window()->IsActive() && model->IsBookmarked(url)) { | 189 if (browser->window()->IsActive() && model->IsBookmarked(url)) { |
190 // Only show the bubble if the window is active, otherwise we may get into | 190 // Only show the bubble if the window is active, otherwise we may get into |
191 // weird situations where the bubble is deleted as soon as it is shown. | 191 // weird situations where the bubble is deleted as soon as it is shown. |
192 browser->window()->ShowBookmarkBubble(url, was_bookmarked); | 192 browser->window()->ShowBookmarkBubble(url, was_bookmarked); |
193 } | 193 } |
194 } | 194 } |
(...skipping 1071 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 |