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

Side by Side Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 23108007: Add width and height to chrome.tabs.Tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code formatting. Check width and height is positive for newly created tab. Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_apitest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/shell_window.h"
8 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 8 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
9 #include "chrome/browser/extensions/shell_window_registry.h" 9 #include "chrome/browser/extensions/shell_window_registry.h"
10 #include "chrome/browser/extensions/tab_helper.h" 10 #include "chrome/browser/extensions/tab_helper.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/extensions/extension_manifest_constants.h" 22 #include "chrome/common/extensions/extension_manifest_constants.h"
23 #include "chrome/common/extensions/manifest_url_handler.h" 23 #include "chrome/common/extensions/manifest_url_handler.h"
24 #include "chrome/common/extensions/permissions/api_permission.h" 24 #include "chrome/common/extensions/permissions/api_permission.h"
25 #include "chrome/common/extensions/permissions/permissions_data.h" 25 #include "chrome/common/extensions/permissions/permissions_data.h"
26 #include "chrome/common/net/url_fixer_upper.h" 26 #include "chrome/common/net/url_fixer_upper.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "content/public/browser/favicon_status.h" 28 #include "content/public/browser/favicon_status.h"
29 #include "content/public/browser/navigation_entry.h" 29 #include "content/public/browser/navigation_entry.h"
30 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
31 #include "content/public/browser/web_contents_view.h"
31 #include "url/gurl.h" 32 #include "url/gurl.h"
32 33
33 namespace keys = extensions::tabs_constants; 34 namespace keys = extensions::tabs_constants;
34 namespace tabs = extensions::api::tabs; 35 namespace tabs = extensions::api::tabs;
35 36
36 using apps::ShellWindow; 37 using apps::ShellWindow;
37 using content::NavigationEntry; 38 using content::NavigationEntry;
38 using content::WebContents; 39 using content::WebContents;
39 using extensions::APIPermission; 40 using extensions::APIPermission;
40 using extensions::Extension; 41 using extensions::Extension;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 result->SetBoolean(keys::kActiveKey, 138 result->SetBoolean(keys::kActiveKey,
138 tab_strip && tab_index == tab_strip->active_index()); 139 tab_strip && tab_index == tab_strip->active_index());
139 result->SetBoolean(keys::kSelectedKey, 140 result->SetBoolean(keys::kSelectedKey,
140 tab_strip && tab_index == tab_strip->active_index()); 141 tab_strip && tab_index == tab_strip->active_index());
141 result->SetBoolean(keys::kHighlightedKey, 142 result->SetBoolean(keys::kHighlightedKey,
142 tab_strip && tab_strip->IsTabSelected(tab_index)); 143 tab_strip && tab_strip->IsTabSelected(tab_index));
143 result->SetBoolean(keys::kPinnedKey, 144 result->SetBoolean(keys::kPinnedKey,
144 tab_strip && tab_strip->IsTabPinned(tab_index)); 145 tab_strip && tab_strip->IsTabPinned(tab_index));
145 result->SetBoolean(keys::kIncognitoKey, 146 result->SetBoolean(keys::kIncognitoKey,
146 contents->GetBrowserContext()->IsOffTheRecord()); 147 contents->GetBrowserContext()->IsOffTheRecord());
148 result->SetInteger(keys::kWidthKey,
149 contents->GetView()->GetContainerSize().width());
150 result->SetInteger(keys::kHeightKey,
151 contents->GetView()->GetContainerSize().height());
147 152
148 // Privacy-sensitive fields: these should be stripped off by 153 // Privacy-sensitive fields: these should be stripped off by
149 // ScrubTabValueForExtension if the extension should not see them. 154 // ScrubTabValueForExtension if the extension should not see them.
150 result->SetString(keys::kUrlKey, contents->GetURL().spec()); 155 result->SetString(keys::kUrlKey, contents->GetURL().spec());
151 result->SetString(keys::kTitleKey, contents->GetTitle()); 156 result->SetString(keys::kTitleKey, contents->GetTitle());
152 if (!is_loading) { 157 if (!is_loading) {
153 NavigationEntry* entry = contents->GetController().GetActiveEntry(); 158 NavigationEntry* entry = contents->GetController().GetActiveEntry();
154 if (entry && entry->GetFavicon().valid) 159 if (entry && entry->GetFavicon().valid)
155 result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec()); 160 result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec());
156 } 161 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 content::OpenURLParams params( 348 content::OpenURLParams params(
344 extensions::ManifestURL::GetOptionsPage(extension), 349 extensions::ManifestURL::GetOptionsPage(extension),
345 content::Referrer(), SINGLETON_TAB, 350 content::Referrer(), SINGLETON_TAB,
346 content::PAGE_TRANSITION_LINK, false); 351 content::PAGE_TRANSITION_LINK, false);
347 browser->OpenURL(params); 352 browser->OpenURL(params);
348 browser->window()->Show(); 353 browser->window()->Show();
349 WebContents* web_contents = 354 WebContents* web_contents =
350 browser->tab_strip_model()->GetActiveWebContents(); 355 browser->tab_strip_model()->GetActiveWebContents();
351 web_contents->GetDelegate()->ActivateContents(web_contents); 356 web_contents->GetDelegate()->ActivateContents(web_contents);
352 } 357 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698