Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: chrome/browser/tabs/tab_strip_model.cc

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_restore_uitest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tabs/tab_strip_model.h" 5 #include "chrome/browser/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/stl_util-inl.h" 11 #include "base/stl_util-inl.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/bookmarks/bookmark_model.h" 15 #include "chrome/browser/bookmarks/bookmark_model.h"
16 #include "chrome/browser/browser_shutdown.h" 16 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_tab_helper.h" 19 #include "chrome/browser/extensions/extension_tab_helper.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/sessions/tab_restore_service.h" 21 #include "chrome/browser/sessions/tab_restore_service.h"
22 #include "chrome/browser/tabs/tab_strip_model_delegate.h" 22 #include "chrome/browser/tabs/tab_strip_model_delegate.h"
23 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" 23 #include "chrome/browser/tabs/tab_strip_model_order_controller.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/browser/ui/webui/web_ui_util.h"
26 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
28 #include "content/browser/renderer_host/render_process_host.h" 27 #include "content/browser/renderer_host/render_process_host.h"
29 #include "content/browser/tab_contents/navigation_controller.h" 28 #include "content/browser/tab_contents/navigation_controller.h"
30 #include "content/browser/tab_contents/tab_contents.h" 29 #include "content/browser/tab_contents/tab_contents.h"
31 #include "content/browser/tab_contents/tab_contents_delegate.h" 30 #include "content/browser/tab_contents/tab_contents_delegate.h"
32 #include "content/browser/tab_contents/tab_contents_view.h" 31 #include "content/browser/tab_contents/tab_contents_view.h"
33 #include "content/browser/user_metrics.h" 32 #include "content/browser/user_metrics.h"
34 #include "content/common/notification_service.h" 33 #include "content/common/notification_service.h"
35 34
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 std::vector<int> indices; 1096 std::vector<int> indices;
1098 indices.push_back(index); 1097 indices.push_back(index);
1099 return indices; 1098 return indices;
1100 } 1099 }
1101 return selection_model_.selected_indices(); 1100 return selection_model_.selected_indices();
1102 } 1101 }
1103 1102
1104 bool TabStripModel::IsNewTabAtEndOfTabStrip( 1103 bool TabStripModel::IsNewTabAtEndOfTabStrip(
1105 TabContentsWrapper* contents) const { 1104 TabContentsWrapper* contents) const {
1106 const GURL& url = contents->tab_contents()->GetURL(); 1105 const GURL& url = contents->tab_contents()->GetURL();
1107 return web_ui_util::ChromeURLHostEquals(url, chrome::kChromeUINewTabHost) && 1106 return url.SchemeIs(chrome::kChromeUIScheme) &&
1108 contents == GetContentsAt(count() - 1) && 1107 url.host() == chrome::kChromeUINewTabHost &&
1109 contents->controller().entry_count() == 1; 1108 contents == GetContentsAt(count() - 1) &&
1109 contents->controller().entry_count() == 1;
1110 } 1110 }
1111 1111
1112 bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, 1112 bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices,
1113 uint32 close_types) { 1113 uint32 close_types) {
1114 if (in_indices.empty()) 1114 if (in_indices.empty())
1115 return true; 1115 return true;
1116 1116
1117 std::vector<int> indices(in_indices); 1117 std::vector<int> indices(in_indices);
1118 bool retval = delegate_->CanCloseContents(&indices); 1118 bool retval = delegate_->CanCloseContents(&indices);
1119 if (indices.empty()) 1119 if (indices.empty())
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1311 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1312 const NavigationController* tab) { 1312 const NavigationController* tab) {
1313 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); 1313 for (TabContentsDataVector::const_iterator i = contents_data_.begin();
1314 i != contents_data_.end(); ++i) { 1314 i != contents_data_.end(); ++i) {
1315 if ((*i)->group == tab) 1315 if ((*i)->group == tab)
1316 (*i)->group = NULL; 1316 (*i)->group = NULL;
1317 if ((*i)->opener == tab) 1317 if ((*i)->opener == tab)
1318 (*i)->opener = NULL; 1318 (*i)->opener = NULL;
1319 } 1319 }
1320 } 1320 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_restore_uitest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698